build method
override
Declares this node's children and behavior.
Runs once on mount, and again whenever the code reassembles.
super.build() is required, as skipping it drops whatever the superclass
declared.
Implementation
@override
void build() {
super.build();
tick((dt) {
final snapshot = request.value;
if (_reported || !snapshot.done) return;
_reported = true;
if (snapshot.cancelled) {
// TODO: Not sure disabling the effect is the right thing to do.
// Realistically, what are you supposed to do if it fails?
// Detatching the node might be the more intuitive response.
disable();
return;
}
if (snapshot.hasError) {
disable();
FlutterError.reportError(
FlutterErrorDetails(
exception: snapshot.error!,
stack: snapshot.stackTrace,
library: 'ignis',
context: ErrorDescription('while preloading'),
),
);
onError.emit(snapshot);
return;
}
onFinish.emit();
});
}