setState method
Allows 'external' routines can call this function.
Implementation
// Note not 'protected' and so can be called by 'anyone.' -gp
@override
void setState(VoidCallback fn) {
if (_rebuildAllowed) {
_rebuildAllowed = false;
// Don't bother if the State object is disposed of.
if (mounted) {
/// Refresh the interface by 'rebuilding' the Widget Tree
/// Call the State object's setState() function.
super.setState(fn);
}
// else {
// // Don't recall why this if statement if not mounted?
// if (WidgetsBinding.instance == null ||
// WidgetsBinding.instance is WidgetsFlutterBinding) {
// /// Refresh the interface by 'rebuilding' the Widget Tree
// super.setState(fn);
// }
// }
_rebuildAllowed = true;
} else {
/// Can't rebuild at this moment but at least make the request.
_rebuildRequested = true;
}
}