Skip to content

Commit 443e1f9

Browse files
committed
Static type for EasyLocalization.assetLoader (aissat#524)
1 parent 2c81ff2 commit 443e1f9

File tree

3 files changed

+29
-23
lines changed

3 files changed

+29
-23
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### [4.0.0]
4+
5+
- **BREAKING:** `EasyLocalization.assetLoader` is now `AssetLoader` (was dynamic).
6+
37
### [3.0.2]
48

59
- support intl 18

lib/src/easy_localization_app.dart

+17-10
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ class EasyLocalization extends StatefulWidget {
6565
/// Class loader for localization files.
6666
/// You can use custom loaders from [Easy Localization Loader](https://github.com/aissat/easy_localization_loader) or create your own class.
6767
/// @Default value `const RootBundleAssetLoader()`
68-
// ignore: prefer_typing_uninitialized_variables
69-
final assetLoader;
68+
final AssetLoader assetLoader;
7069

7170
/// Save locale in device storage.
7271
/// @Default value true
@@ -195,9 +194,12 @@ class _EasyLocalizationProvider extends InheritedWidget {
195194

196195
// _EasyLocalizationDelegate get delegate => parent.delegate;
197196

198-
_EasyLocalizationProvider(this.parent, this._localeState,
199-
{Key? key, required this.delegate})
200-
: currentLocale = _localeState.locale,
197+
_EasyLocalizationProvider(
198+
this.parent,
199+
this._localeState, {
200+
Key? key,
201+
required this.delegate,
202+
}) : currentLocale = _localeState.locale,
201203
super(key: key, child: parent.child) {
202204
EasyLocalization.logger.debug('Init provider');
203205
}
@@ -245,8 +247,10 @@ class _EasyLocalizationDelegate extends LocalizationsDelegate<Localization> {
245247
/// * use only the lang code to generate i18n file path like en.json or ar.json
246248
// final bool useOnlyLangCode;
247249

248-
_EasyLocalizationDelegate(
249-
{this.localizationController, this.supportedLocales}) {
250+
_EasyLocalizationDelegate({
251+
this.localizationController,
252+
this.supportedLocales,
253+
}) {
250254
EasyLocalization.logger.debug('Init Localization Delegate');
251255
}
252256

@@ -260,9 +264,12 @@ class _EasyLocalizationDelegate extends LocalizationsDelegate<Localization> {
260264
await localizationController!.loadTranslations();
261265
}
262266

263-
Localization.load(value,
264-
translations: localizationController!.translations,
265-
fallbackTranslations: localizationController!.fallbackTranslations);
267+
Localization.load(
268+
value,
269+
translations: localizationController!.translations,
270+
fallbackTranslations: localizationController!.fallbackTranslations,
271+
);
272+
266273
return Future.value(Localization.instance);
267274
}
268275

pubspec.yaml

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
name: easy_localization
2-
description: Easy and Fast internationalizing and localization your Flutter Apps, this package simplify the internationalizing process .
2+
description: Easy and fast internationalizing and localization your Flutter Apps, this package simplifies the internationalizing process.
33
# author: AISSAT abdelwahab <mr.aissat@gmail.com>
44
homepage: https://github.com/aissat/easy_localization
55
issue_tracker: https://github.com/aissat/easy_localization/issues
6-
# publish_to: none
76

8-
version: 3.0.2
7+
version: 4.0.0-dev
98

109
environment:
1110
sdk: '>=2.12.0 <4.0.0'
1211

1312
dependencies:
14-
flutter:
15-
sdk: flutter
16-
shared_preferences: '>=2.0.0 <3.0.0'
17-
intl: '>=0.17.0-0 <=0.18.1'
1813
args: ^2.3.1
19-
path: ^1.8.1
2014
easy_logger: ^0.0.2
21-
flutter_localizations:
22-
sdk: flutter
23-
15+
flutter: { sdk: flutter }
16+
flutter_localizations: { sdk: flutter }
17+
intl: '>=0.17.0-0 <=0.18.1'
18+
path: ^1.8.1
19+
shared_preferences: '>=2.0.0 <3.0.0'
2420

2521
dev_dependencies:
26-
flutter_test:
27-
sdk: flutter
2822
flutter_lints: ^2.0.1
23+
flutter_test: { sdk: flutter }

0 commit comments

Comments
 (0)