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

Sample code at README.md doesn't work #310

Closed
no1-knows opened this issue Mar 26, 2020 · 1 comment
Closed

Sample code at README.md doesn't work #310

no1-knows opened this issue Mar 26, 2020 · 1 comment

Comments

@no1-knows
Copy link

I'm pretty new to flatter and sample doesn't work.

Environment

Flutter version: v1.12.13+hotfix.8
Plugin version: ^2.1.0+1
Android version:
iOS version: 11pro
Xcode version: 11.3.1
Device information:

Description

I got blank page if i try sample code both InAppBrowser and ChromeSafariBrowser.
console notifications

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
If you're running an application and need to access the binary messenger before `runApp()` has been called (for example, during plugin initialization), then you need to explicitly call the `WidgetsFlutterBinding.ensureInitialized()` first.
If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding.

Expected behavior:
Sample work like gif

Current behavior:
I got blank page

How to fix
Both InAppBrowser and ChromeSafariBrowser sample code change void main() => runApp(new MyApp()); to below

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(
    new MyApp(),
  );
}

https://stackoverflow.com/questions/57689492/flutter-unhandled-exception-servicesbinding-defaultbinarymessenger-was-accesse/57703060#57703060

@pichillilorenzo
Copy link
Owner

Fixed, thanks!

This was referenced Jul 6, 2020
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

2 participants