File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,19 @@ class FlareCacheBuilder extends StatefulWidget {
1717}
1818
1919class _FlareCacheBuilderState extends State <FlareCacheBuilder > {
20- bool isWarm = false ;
20+ bool _isWarm = false ;
21+ bool get isWarm => _isWarm;
22+ set isWarm (bool value) {
23+ if (value == _isWarm) {
24+ return ;
25+ }
26+ if (mounted) {
27+ setState (() {
28+ _isWarm = value;
29+ });
30+ }
31+ }
32+
2133 final Set <FlareCacheAsset > _assets = {};
2234 @override
2335 void initState () {
@@ -62,24 +74,21 @@ class _FlareCacheBuilderState extends State<FlareCacheBuilder> {
6274 }
6375
6476 bool _updateWarmth () {
77+ if (! mounted) {
78+ return true ;
79+ }
6580 var filenames = widget.filenames;
6681 if (filenames == null ) {
67- setState (() {
68- isWarm = true ;
69- });
82+ isWarm = true ;
7083 return true ;
7184 }
7285 for (final filename in filenames) {
7386 if (getWarmActor (bundle, filename) == null ) {
74- setState (() {
75- isWarm = false ;
76- });
87+ isWarm = false ;
7788 return false ;
7889 }
7990 }
80- setState (() {
81- isWarm = true ;
82- });
91+ isWarm = true ;
8392 return true ;
8493 }
8594
You can’t perform that action at this time.
0 commit comments