Flutter 将本地存储的图像传递到social_share插件的路径
当用户共享内容时,我想将我的pubspec.yaml资产文件中本地存储的图像传递给社交共享插件。我可以从截图和图库中分享,但我不知道如何分享本地图像Flutter 将本地存储的图像传递到social_share插件的路径,flutter,dart,socialshare,Flutter,Dart,Socialshare,当用户共享内容时,我想将我的pubspec.yaml资产文件中本地存储的图像传递给社交共享插件。我可以从截图和图库中分享,但我不知道如何分享本地图像 RaisedButton( onPressed: () async { SocialShare.shareInstagramStory( 'assets/images/iPhone_11_Pro_fast_food.png',
RaisedButton(
onPressed: () async {
SocialShare.shareInstagramStory(
'assets/images/iPhone_11_Pro_fast_food.png',
backgroundTopColor: "#ffffff",
backgroundBottomColor: "#000000",
attributionURL: "https://deep-link-url",
backgroundImagePath:
'assets/images/iPhone_11_Pro_fast_food.png',
).then((data) {
print(data);
});
},
child: Text("Share On Instagram Story"),
),
正如您所看到的,我已经输入了路径,这导致了一个错误
image path FileImage("assets/images/iPhone_11_Pro_fast_food.png", scale: 1.0)
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'