Open glavigno opened 3 years ago
yes i am also faced this
I have the same problem. You can override AssetLoader to change the localization source:
class MockAssetLoader extends AssetLoader {
@override
Future<Map<String, dynamic>?> load(String path, Locale locale) async {
return <String, dynamic>{
'aaa': <String, dynamic>{
'bbb': <String, dynamic>{
'ccc': <String, dynamic>{
'ddd': 'ddd',
'eee': 'eee',
},
'fff': 'fff',
},
},
};
}
}
Then add a new AssetLoader to the EasyLocalization constructor:
EasyLocalization(
assetLoader: assetLoader,
child: child,
);
I am using the version 2.3.0 of the package and wrote a test file containing multiple widget tests for a localized widget. I noticed that EasyLocalization logs does not run localization delegate and provider initialization after the first test.
Here is my test. TestableAddCardScreen function in setUp hook is in charge of wrapping widget in EasyLocalization.
I ran the same test twice in a row on purpose and here are the logs.
Thanks for your help.