Ben Konyi
Ben Konyi
Oct 4, 2018 · 1 min read

registerWith is called once for each registry: the registry for the main FlutterActivity and the registry for the FlutterNativeView. The registry is used for a few different functions, but the reason why we call registerWith is to setup handlers for each plugin to handle calls over MethodChannels.

Since FlutterActivity and FlutterNativeView have their own registries, if we neglect to call registerWith on the FlutterNativeView’s registry an exception will be thrown when any other plugin tries to call a native method when executing in the background. This is due to the fact that the MethodChannel’s name won’t be in the FlutterNativeView’s registry as it was never registered.

Let me know if my explanation isn’t clear and I’ll be glad to help :)

    Ben Konyi

    Written by

    Ben Konyi

    Google Software Engineer — Dart VM Hacker, Flutter Runtime Dev, Amateur Cyclist, and Proud Canadian 🍁