I've used Flutter's add-to-app documentation to run a small Flutter application as a native module inside an existing iOS app.
The Flutter app included some images in the pubspec.yaml
from an assets
folder like so:
assets:
- assets/
According to Flutter docs, those assets are bundled with the app.
If I run the Flutter app on its own, it works fine. But when I run it in iOS, I get this error:
The following assertion was thrown resolving an image codec:
2021-01-11 14:41:51.204874-0800 flutter: Unable to load asset: assets/CONNECT.png
flutter: When the exception was thrown, this was the stack:
2021-01-11 14:41:51.205397-0800 flutter: #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:227:7)
flutter: Image provider: AssetImage(bundle: null, name: "assets/CONNECT.png")
2021-01-11 14:41:51.209366-0800 flutter: Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#893a5(), name: "assets/CONNECT.png",
Any documentation I find is talking about loading a Flutter asset in an iOS app or vice-versa. But this is a Flutter app loading its own assets in a native iOS app and I'm not sure of the fix.
Has anyone done this before and know what to do to resolve?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…