Flutter 使用Flatter WEB将内容共享到社交媒体

Flutter 使用Flatter WEB将内容共享到社交媒体,flutter,web,dart,share,Flutter,Web,Dart,Share,我已经使用了几个库在flutter android/iOS上共享内容,直到最近我才想在flutter WEB上实现共享功能。虽然我使用了相同的库,但它给出了一个缺少PluginException的错误。这很可能是因为颤振Web平台没有配置 Overflow on channel: social_share. Messages on this channel are being discarded in FIFO fashion. The engine may not be running o

我已经使用了几个库在flutter android/iOS上共享内容,直到最近我才想在flutter WEB上实现共享功能。虽然我使用了相同的库,但它给出了一个缺少PluginException的错误。这很可能是因为颤振Web平台没有配置

Overflow on channel: social_share.  Messages on this channel are being discarded in FIFO fashion.  The engine may not be running or you need to adjust the buffer size if of
the channel.
Error: MissingPluginException(No implementation found for method shareWhatsapp on channel social_share)
    at Object.throw_ [as throw] (http://localhost:58884/dart_sdk.js:4314:11)
    at MethodChannel._invokeMethod (http://localhost:58884/packages/flutter/src/services/platform_channel.dart.lib.js:410:21)
    at _invokeMethod.next (<anonymous>)
    at http://localhost:58884/dart_sdk.js:37184:33
    at _RootZone.runUnary (http://localhost:58884/dart_sdk.js:37038:58)
    at _FutureListener.thenAwait.handleValue (http://localhost:58884/dart_sdk.js:32022:29)
    at handleValueCallback (http://localhost:58884/dart_sdk.js:32569:49)
    at Function._propagateToListeners (http://localhost:58884/dart_sdk.js:32607:17)
    at _Future.new.[_completeWithValue] (http://localhost:58884/dart_sdk.js:32450:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:58884/dart_sdk.js:32472:35)
    at Object._microtaskLoop (http://localhost:58884/dart_sdk.js:37299:13)
    at _startMicrotaskLoop (http://localhost:58884/dart_sdk.js:37305:13)
    at http://localhost:58884/dart_sdk.js:32824:9

有没有办法做到这一点?或者为它实现任何Web插件?

使用onPressed方法中的setstate((){})方法,并将您的逻辑放入其中。

我认为还没有任何共享插件提供Flatter Web支持。
尽管如此,您可以使用插件之类的工具复制用户需要共享的内容,并要求他们粘贴并发送给朋友。

我认为这与setState方法无关。。我使用的是Flatter Web,没有实现。。请在回答问题之前阅读完整的问题
class SocialMediaLogo extends StatelessWidget {
  final String logo;
  SocialMediaLogo(this.logo);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(5),
      child: RaisedButton(
          onPressed: () async {
            SocialShare.shareWhatsapp("Hello World \n https://google.com")
                .then((data) {
              print(data);
            });
          },
          child: Image(
            image: AssetImage("icons/$logo.png"),
            height: 35,
            width: 35,
            fit: BoxFit.cover,
          )),
    );
  }
}