performRebuild method
Cause the component to update itself.
Called by BuildOwner after the appropriate checks have been made.
Implementation
@override
void performRebuild() {
assert(_debugSetAllowIgnoredCallsToMarkNeedsBuild(true));
Component? built;
try {
assert(() {
_debugDoingBuild = true;
return true;
}());
built = build();
assert(() {
_debugDoingBuild = false;
return true;
}());
} catch (e, st) {
_debugDoingBuild = false;
// TODO: implement actual error handling
built = Component.element(
tag: 'div',
styles: const Styles(
padding: Padding.all(Unit.em(2)),
backgroundColor: Colors.red,
color: Colors.yellow,
fontSize: Unit.rem(1),
),
children: [Component.text('Error on building component: $e')],
);
binding.reportBuildError(this, e, st);
} finally {
_dirty = false;
assert(_debugSetAllowIgnoredCallsToMarkNeedsBuild(false));
}
_child = updateChild(_child, built, slot);
}