Closed
Description
Hi, thanks for the library!
If I have no await
delay in between setting _loading to true and false, the component remains showing the loading spinner indefinitely. If I have a very short delay instead (eg 1-10 ms), the component crashes with:
======== Exception caught by widgets library =======================================================
The following assertion was thrown building _BodyBuilder:
Hide called, but not showing!
'package:declarative_refresh_indicator/declarative_refresh_indicator.dart':
Failed assertion: line 122 pos 12: '_showing'
Example:
@override
void initState() {
super.initState();
_refresh();
}
void _refresh() async {
setState(() => _loading = true);
//wait anything under ~500ms, or have no `await` at all
await Future<void>.delayed(Duration(milliseconds: 1));
if (mounted) setState(() => _loading = false);
}
This occurs if _refresh
is called immediately from initState
.
Metadata
Metadata
Assignees
Labels
No labels