FlutterWayland / flutter_wlroots

Wayland compositor embedder and library for Flutter. Built with Wlroots.
MIT License
30 stars 5 forks source link

Error: Unhandled Exception: Binding has not yet been initialized. #22

Closed charafau closed 1 year ago

charafau commented 1 year ago

Current master is broken with bindings error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Binding has not yet been initialized.
The "instance" getter on the WidgetsBinding binding mixin is only available once that binding has been initialized.
Typically, this is done by calling "WidgetsFlutterBinding.ensureInitialized()" or "runApp()" (the latter calls the former). Typically this call is done in the "void main()" method. The "ensureInitialized" method is idempotent; calling it multiple times is not harmful. After calling that method, the "instance" getter will return the binding.
In a test, one can call "TestWidgetsFlutterBinding.ensureInitialized()" as the first line in the test's "main()" method to initialize the binding.
If WidgetsBinding is a custom binding mixin, there must also be a custom binding class, like WidgetsFlutterBinding, but that mixes in the selected binding, and that is the class that must be constructed before using the "instance" getter.
#0      BindingBase.checkInstance.<anonymous closure> (package:flutter/src/foundation/binding.dart:284:9)
#1      BindingBase.checkInstance (package:flutter/src/foundation/binding.dart:366:6)
#2      WidgetsBinding.instance (package:flutter/src/widgets/binding.dart:273:53)
#3      InterceptorWidgetsBinding.ensureInitialized (package:compositor_dart/platform/interceptor_widgets_binding.dart:20:24)
#4      InterceptorWidgetsBinding.runApp (package:compositor_dart/platform/interceptor_widgets_binding.dart:27:31)
#5      main (package:demo/main.dart:14:29)
#6      _runMain.<anonymous closure> (dart:ui/hooks.dart:134:23)
#7      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)