method_channel

A simple flutter plugin wrap method channel in order to execute in background.

1 Why need a wrapper for method channel

1.1 TL;DR

  • Call method channel directly with background Flutter Engine while the app is terminated causes MissingPluginException(No implementation found for method echo on channel com.presence.test_channel), but in a plugin (with it registered properly), things will work like a charm.

1.2 Deep Reason:

1.3 How to repeat:

  • refer to work_manager_plugin docs

  • the example project of current repository is designed to reproduce this

    STEP1: open the example/ios/Runner.xcworkspace in XCode STEP2: start the Runner target in a device (simulator or real one) STEP3: click Debug/Simulate Background Fetch, example/lib/main.dart.callbackDispatcher will be called by native and you will see the error in XCode console

1.4 How to resolve

wrap your method channel call in a plugin (like this one) and register it properly

Getting Started

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

GitHub

View Github