Unverified Commit ae62a3cf authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Error Message for createState assertion (#44610)

* Init

* Added error message to assert

* Removing unrelated changes
parent b1ca7f41
......@@ -4055,7 +4055,12 @@ class StatefulElement extends ComponentElement {
}());
assert(_state._element == null);
_state._element = this;
assert(_state._widget == null);
assert(
_state._widget == null,
'The createState function for $widget returned an old or invalid state '
'instance: ${_state._widget}, which is not null, violating the contract '
'for createState.',
);
_state._widget = widget;
assert(_state._debugLifecycleState == _StateLifecycle.created);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment