You need to be able access the widget.
@override // ignore: avoid_as T get widget => super.widget as T;