iT邦幫忙

0

(Flutter)*.riv 檔無法被 SplashScreen.navigate() 讀取

  • 分享至 

  • xImage

先謝謝瀏覽我的問題,我目前初學 flutter,嘗試使用 flare_splash_screen 套件。
我在 Rive 建立了官方模板的檔案,下載 for RunTime 的 .riv 檔案,寫成如以下:

return
      SplashScreen.navigate(
      name: 'assets/images/mixing_animations.riv',
      next: (_) => const LoginPage(),
      until: () => Future.delayed(const Duration(seconds: 3)),
    );

然後收到錯誤回報:

E/flutter (24196): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Unexpected character (at character 1)
E/flutter (24196): RIVE

我在 pubspec.yaml 的相關配置如下:

version: 1.0.0+1

environment:
  sdk: '^3.1.5'
dependencies:
  flutter:
    sdk: flutter
  flare_splash_screen: ^4.0.0
  //...
flutter:
  assets:
    - assets/images/

我目前的理解是我的 .riv 檔案可能有問題,因為我從 images 撈過其他圖片是沒問題,所以有另外建立不同的檔案並重新下載過,也照 Bard 的建議轉換過編碼(UTF-8),都沒有成功。

轉換成 UTF-8 編碼的話會回報以下錯誤:

E/flutter (24449): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Unexpected character (at character 1)
E/flutter (24449): RIVE 瞨)????? €   H zD 道
E/flutter (24449): ^
E/flutter (24449):
E/flutter (24449): #0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
E/flutter (24449): #1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
E/flutter (24449): #2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
E/flutter (24449): #3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
E/flutter (24449): #4 JsonDecoder.convert (dart:convert/json.dart:610:36)
E/flutter (24449): #5 JsonCodec.decode (dart:convert/json.dart:216:41)
E/flutter (24449): #6 jsonDecode (dart:convert/json.dart:155:10)
E/flutter (24449): #7 Actor.load (package:flare_flutter/base/actor.dart:72:27)
E/flutter (24449): #8 FlutterActor.loadFromByteData (package:flare_flutter/flare.dart:165:17)
E/flutter (24449): #9 compute. (package:flutter/src/foundation/_isolates_io.dart:19:20)
E/flutter (24449): #10 _RemoteRunner._run (dart:isolate:1021:47)
E/flutter (24449): #11 _RemoteRunner._remoteExecute (dart:isolate:1015:12)
E/flutter (24449): #12 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:299:17)
E/flutter (24449): #13 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)

請問我還應該從哪個方向思考呢?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答