首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用flutter WEB将内容共享到社交媒体

使用flutter WEB将内容共享到社交媒体
EN

Stack Overflow用户
提问于 2020-07-14 20:18:09
回答 4查看 1.1K关注 0票数 1

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

代码语言:javascript
运行
复制
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

代码:

代码语言:javascript
运行
复制
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,
          )),
    );
  }
}

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

EN

回答 4

Stack Overflow用户

发布于 2020-09-02 06:15:37

我认为目前还没有任何共享插件提供Flutter web支持。尽管如此,你可以使用像clipboard插件这样的东西来复制你的用户需要分享的内容,并要求他们粘贴并发送给他们的朋友。

票数 0
EN

Stack Overflow用户

发布于 2021-09-08 10:09:15

对于文本,您可以使用share_plus:,但仍然很难与其共享图像,但对于文本,它可以很好地工作

票数 0
EN

Stack Overflow用户

发布于 2021-09-08 18:28:40

我已经开始开发一个插件,它可以检测应用程序是在桌面还是移动设备上运行。https://pub.dev/packages/share_everywhere

如果你在台式机上,它将弹出你选择的网络,在移动设备上,它将使用标准的颤动共享库。

让我知道你的想法和我如何改进

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62895028

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档