Flutter 分享功能之Share

效果:

在这里插入图片描述在这里插入图片描述在这里插入图片描述

Summons the platform’s share sheet to share text.

非常简单,但也仅限于文本。


1、导入及引用

share: ^0.6.1+1
import 'package:share/share.dart';

2、调用

Share.share( '【玩安卓Flutter版】\n https://github.com/yechaoa/wanandroid_flutter');

ok,就这么简单,但要注意的是需要重启之后才能正确调用,不然会有异常:

MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/share)

关闭重新打开项目即可。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章