extend widget flutter code example
Example 1: extend class flutter
class Class1 {
String text;
Class1({this.text});
}
class Class2 extends Class1 {
List<FormControls> form;
Class2({text, this.form}) : super(text: text);
}
Example 2: flutter inhereted widget
class MyInherited extends InheritedWidget {
const MyInherited({
Key key,
@required Widget child,
}) : super(key: key, child: child);
static MyInherited of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<MyInherited>();
}
//if you have properties, it should look something like:
// bool updateShouldNotify(MyInherited old) => old.prop !== new.prop;
//if you don't:
@override
bool updateShouldNotify(MyInherited old) => false;
}