Ad

Flutter Share_plus Is Not Working And Getting Error

- 1 answer

I want to share text / url in my app and I'm using share_plus plugin for this.

        IconButton(
            icon: const Icon(Icons.share),
            onPressed: (){
              Share.share("Testing Share function");
            }
        ),

And I'm getting error:

E/flutter (21225): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method share on channel dev.fluttercommunity.plus/share)
E/flutter (21225): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
E/flutter (21225): <asynchronous suspension>
E/flutter (21225): 

How to fix this?

Ad

Answer

If you are using hot restart or hot reload, it won't do the trick. Since Flutter has to inject plugin dependencies into the platform-specific parts of your app, hot restart/hot reload is not enough to trigger the injection.

Close the app and execute command.

flutter clean

flutter run

Ad
source: stackoverflow.com
Ad