我的文件endpoints.json
位于/WORKPLACE_DIR/assets/json/endpoints.json
{
"key": "value"
}
我已经更新了pubspec.yaml
assets:
- assets/json/endpoints.json
在/tests/some_test.dart
我愿意
test('my test', () async {
final endpoints = json.decode(await rootBundle.loadString("assets/json/endpoints.json"));
}
它仍然给出错误
ERROR: Unable to load asset: assets/json/endpoints.json
package:flutter/src/services/asset_bundle.dart 221:7 PlatformAssetBundle.load
===== asynchronous gap ===========================
dart:async _AsyncAwaitCompleter.completeError
package:flutter/src/services/asset_bundle.dart PlatformAssetBundle.load
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
package:flutter/src/services/asset_bundle.dart PlatformAssetBundle.load
package:flutter/src/services/asset_bundle.dart 67:33 AssetBundle.loadString
我已经尝试过flutter clean
,但仍然出现此错误。我不确定该怎么办。