0

我有一个火炬包的错误。

我有一个 3 页的标签栏,

第一个选项卡我堆叠了 3 个耀斑动画。特殊性:对于每个 initState,我使用 sharedpref 加载资产名称以显示保存的动画。第二个和第三个标签没什么特别的

当我将选项卡 1 滑动到 2 和 2 到 1 x Time 时,有时我只会因为这个堆栈耀斑动画而崩溃,而不是其他动画。

我在 tab1 的初始化处加载了之前保存的资产名称:

asset_name_animation = prefs.getString('item' ) ?? "fond_vide";  

我显示加载的资产名称:

new Container (
  width:400,
  height: 400,
  child: new FlareActor("assets/$asset_name_animation.flr", 
    alignment:Alignment.bottomCenter, 
    fit:BoxFit.contain,  
    animation: "Untitled"
  )
),

这是错误日志:

E/flutter ( 9171): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Unable to load asset: assets/null.flr
E/flutter ( 9171): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #1      FlareCacheAsset.load (package:flare_flutter/flare_cache_asset.dart:31:20)
E/flutter ( 9171): #2      Cache.getAsset (package:flare_flutter/cache.dart:56:15)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #3      cachedActor (package:flare_flutter/flare_cache.dart:35:16)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #4      FlareRenderBox.loadFlare (package:flare_flutter/flare_render_box.dart:322:35)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #5      FlareActorRenderObject.coldLoad (package:flare_flutter/flare_actor.dart:321:20)
E/flutter ( 9171): <asynchronous suspension>
E/flutter ( 9171): #6      FlareRenderBox.load (package:flare_flutter/flare_render_box.dart:272:7)
E/flutter ( 9171): #7      FlareRenderBox.attach (package:flare_flutter/flare_render_box.dart:115:7)
E/flutter ( 9171): #8      AbstractNode.adoptChild (package:flutter/src/foundation/node.dart:132:13)
E/flutter ( 9171): #9      RenderObject.adoptChild (package:flutter/src/rendering/object.dart:1153:11)
E/flutter ( 9171): #10     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin.child= (package:flutter/src/rendering/object.dart:2772:7)
E/flutter ( 9171): #11     SingleChildRenderObjectElement.insertChildRenderObject (package:flutter/src/widgets/framework.dart:5107:18)
E/flutter ( 9171): #12     RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:4951:35)
E/flutter ( 9171): #13     RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4717:5)
E/flutter ( 9171): #14     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #15     Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #16     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
E/flutter ( 9171): #17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #18     Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #19     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
E/flutter ( 9171): #20     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 9171): #21     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
E/flutter ( 9171): #22     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
E/flutter ( 9171): #23     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #24     Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #25     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
E/flutter ( 9171): #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #27     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5198:32)
E/flutter ( 9171): #28     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #29     Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #30     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
E/flutter ( 9171): #31     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 9171): #32     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
E/flutter ( 9171): #33     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
E/flutter ( 9171): #34     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #35     Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #36     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
E/flutter ( 9171): #37     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
E/flutter ( 9171): #38     Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
E/flutter ( 9171): #39     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
E/flutter ( 9171): #40     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 9171): #41     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
E/flutter ( 9171): #42     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
E/flutter ( 9171): #43     ParentDataElement.mount (package:flutter/src/widgets/framework.dart:4279:11)
E/flutter ( 9171): #44     Element.inflateWidget (pac

我有另一个可重复的崩溃并且有相同的动画问题:当我启动一条路线 => 返回 => 滑动选项卡 2 => 滑动选项卡 1 时,我有这个错误和动画崩溃。

E/flutter ( 9171): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
E/flutter ( 9171): At this point the state of the widget's element tree is no longer stable.
E/flutter ( 9171): To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling inheritFromWidgetOfExactType() in the widget's didChangeDependencies() method.
E/flutter ( 9171): #0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure> (package:flutter/src/widgets/framework.dart:3389:9)
E/flutter ( 9171): #1      Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:3403:6)
E/flutter ( 9171): #2      Element.inheritFromWidgetOfExactType (package:flutter/src/widgets/framework.dart:3418:12)
E/flutter ( 9171): #3      TickerMode.of (package:flutter/src/widgets/ticker_provider.dart:52:39)
E/flutter ( 9171): #4      _analyse2State&State&WidgetsBindingObserver&TickerProviderStateMixin.didChangeDependencies (package:flutter/src/widgets/ticker_provider.dart:197:36)
E/flutter ( 9171): #5      analyse2State.didChangeDependencies (package:ouiquit_app/tableau_de_bord.dart:5533:11)
E/flutter ( 9171): #6      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:77:64)
E/flutter ( 9171): #7      _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 9171): #8      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 9171): #9      _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter ( 9171): #10     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter ( 9171): #11     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter ( 9171): #12     Future._complete (dart:async/future_impl.dart:473:7)
E/flutter ( 9171): #13     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 9171): #14     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
E/flutter ( 9171): #15     _rootRun (dart:async/zone.dart:1120:38)
E/flutter ( 9171): #16     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 9171): #17     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 9171): #18     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 9171): #19     _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 9171): #20     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 9171): #21     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 9171): #22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 9171): #23     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 9171): #24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter ( 9171): 
4

1 回答 1

0

即使我有这个错误,但几秒钟后动画就开始了,它显示没有任何滞后尝试做flutter clean

于 2020-02-03T06:31:54.847 回答