Search
[Flutter/dart] ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialize
- M.R

- Aug 16, 2021
- 1 min read
Overview
Suddenly the above error message appears and the app crashes. As in the error message and the article on the net, adding
WidgetsFlutterBinding.ensureInitialized();at the top of main() doesn't solve the problem.
Cause and solution
It seems that the cause was accessing assets from another isolate. (reference)
As a solution, I used flutter_isolate and the above error disappeared.
Click here for how to use flutter_isolate
Lastly
(Added on 2021/2/20)
Since flutter_isolate creates a new dart execution environment in another isolate, it will not be recognized as "another isolate" and no error will occur (reference). However, flutter_isolate officially supports only some libraries such as notification, so it is at your own risk.






Comments