Error Message for createState assertion (#44610)

* Init

* Added error message to assert

* Removing unrelated changes
This commit is contained in:
Kate Lovett 2019-11-15 13:05:18 -08:00 committed by GitHub
parent b1ca7f419e
commit ae62a3cf1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}