From d74df3c9c8f07522f3de98ed4638ae142b22b24c Mon Sep 17 00:00:00 2001 From: Baha Date: Sat, 25 Mar 2023 00:40:30 +0300 Subject: [PATCH 1/3] Fix nullable value --- lib/src/localization.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/localization.dart b/lib/src/localization.dart index dc5fa224..2f320f1b 100644 --- a/lib/src/localization.dart +++ b/lib/src/localization.dart @@ -22,7 +22,9 @@ class Localization { Localization(); static Localization? _instance; + static Localization get instance => _instance ?? (_instance = Localization()); + static Localization? of(BuildContext context) => Localizations.of(context, Localization); @@ -108,9 +110,9 @@ class Localization { return res; } - static PluralRule? _pluralRule(String? locale, num howMany) { + static PluralRule _pluralRule(String? locale, num howMany) { startRuleEvaluation(howMany); - return pluralRules[locale]; + return pluralRules[locale] ?? () => PluralCase.OTHER; } String plural( @@ -135,7 +137,7 @@ class Localization { pluralCase = PluralCase.TWO; break; default: - pluralCase = pluralRule!(); + pluralCase = pluralRule(); } switch (pluralCase) { case PluralCase.ZERO: From 9328669f5122b15cebc59b21842b90c399dc4b0d Mon Sep 17 00:00:00 2001 From: Baha Date: Mon, 10 Apr 2023 10:43:03 +0300 Subject: [PATCH 2/3] Update pubspec.yaml --- pubspec.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index a9b5f2f5..7f594c32 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,15 +11,15 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: + args: ^2.4.0 + easy_logger: ^0.0.2 flutter: sdk: flutter - shared_preferences: '>=2.0.0 <3.0.0' - intl: '>=0.17.0-0 <=0.17.0' - args: ^2.3.1 - path: ^1.8.1 - easy_logger: ^0.0.2 flutter_localizations: sdk: flutter + intl: ^0.17.0 + path: ^1.8.2 + shared_preferences: ^2.1.0 dev_dependencies: From c8301578ab2d31e4a7799480d5515e12b8aa75ae Mon Sep 17 00:00:00 2001 From: Baha Date: Wed, 10 May 2023 22:09:03 +0300 Subject: [PATCH 3/3] Update pubspec.yaml --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 7f594c32..b37865bd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ issue_tracker: https://github.com/aissat/easy_localization/issues version: 3.0.2-dev.5 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: args: ^2.4.0 @@ -17,7 +17,7 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - intl: ^0.17.0 + intl: ^0.18.0 path: ^1.8.2 shared_preferences: ^2.1.0