【问题标题】:I want to post to an Instagram story from the Flutter app我想从 Flutter 应用发布到 Instagram 故事
【发布时间】:2021-01-16 12:50:30
【问题描述】:

我一边看this一边做。

SocialShare.shareInstagramStory(imageFile.path, "#ffffff", “#000000”、“https://deep-link-url”); 它说,我应该在“File.pash”中输入什么?我在“pubspec.yaml”中写了图像的路径并按原样输入了路径,但是

FileSystemException: Cannot open file, path = 'assets/Icon.jpeg' (OS Error: No such file or directory, errno = 2)

我得到一个错误。正确答案是什么?

【问题讨论】:

    标签: android flutter dart instagram


    【解决方案1】:

    您应该使用rootBundle 来加载资产。

    import 'dart:async' show Future;
    import 'package:flutter/services.dart' show rootBundle;
    
    Future<String> loadAsset() async {
      return await rootBundle.loadString('assets/config.json');
    }
    

    【讨论】:

    • Exception: FormatException: Invalid UTF-8 byte 但是这出来了,我有麻烦了……我不认为这很奇怪,因为图像文件没有经过处理,而且不是我拍的照片。跨度>
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-13
    • 1970-01-01
    • 1970-01-01
    • 2022-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多