Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Country code and disable images in flutter driver test #49

Closed
pinball83 opened this issue Dec 1, 2020 · 3 comments
Closed

Country code and disable images in flutter driver test #49

pinball83 opened this issue Dec 1, 2020 · 3 comments

Comments

@pinball83
Copy link

After adding this library my driver test start failing and images from assets did not display

@Abdi-Adan
Copy link

Requesting assistance for the same.

@pinball83
Copy link
Author

@Abdi-Adan There are exist workaround, you need add check that your application run under dreiver test and setup custom AssetBundle instead of
runApp(FlApp());
change for this
runApp(DefaultAssetBundle( bundle: TestAssetBundle(), child: YourApp(), ));
and TestAssetBundle implementation:
`class TestAssetBundle extends CachingAssetBundle {
@OverRide
Future loadString(String key, {bool cache = true}) async {
final ByteData data = await load(key);
if (data == null) throw FlutterError('Unable to load asset');
return utf8.decode(data.buffer.asUint8List());
}

@OverRide
Future load(String key) async => rootBundle.load(key);
}`

@Abdi-Adan
Copy link

Abdi-Adan commented Feb 1, 2021

Adding assets folder from this package to the root of my project seems to have worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants