您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

38 行
1.1 KiB

using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {
public class DisposableBuildContext<T> where T : State{
public DisposableBuildContext(T state) {
D.assert(_state != null);
D.assert(_state.mounted, () => "A DisposableBuildContext was given a BuildContext for an Element that is not mounted.");
}
T _state;
public BuildContext context {
get {
D.assert(_debugValidate());
if (_state == null) {
return null;
}
return _state.context;
}
}
public bool _debugValidate() {
D.assert(
_state == null || _state.mounted,() =>
"A DisposableBuildContext tried to access the BuildContext of a disposed " +
"State object. This can happen when the creator of this " +
"DisposableBuildContext fails to call dispose when it is disposed."
);
return true;
}
public void dispose() {
_state = null;
}
}
}