using Unity.UIWidgets.foundation; namespace Unity.UIWidgets.widgets { public abstract class UniqueWidget :StatefulWidget where T: State { public UniqueWidget( GlobalKey key ) : base(key: key) { D.assert(key != null); } public abstract override State createState(); T currentState { get { GlobalKey globalKey = key as GlobalKey; return globalKey.currentState; } } } }