Add maybeOf for all the cases where of returns nullable. (#114120)
This commit is contained in:
@@ -34,7 +34,7 @@ class FromSectionExample extends StatelessWidget {
|
||||
child: Form(
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
onChanged: () {
|
||||
Form.of(primaryFocus!.context!)?.save();
|
||||
Form.maybeOf(primaryFocus!.context!)?.save();
|
||||
},
|
||||
child: CupertinoFormSection.insetGrouped(
|
||||
header: const Text('SECTION 1'),
|
||||
|
||||
@@ -38,7 +38,7 @@ class MyStatelessWidget extends StatelessWidget {
|
||||
// The Builder widget is used to have a different BuildContext to access
|
||||
// closest DefaultTabController.
|
||||
child: Builder(builder: (BuildContext context) {
|
||||
final TabController tabController = DefaultTabController.of(context)!;
|
||||
final TabController tabController = DefaultTabController.of(context);
|
||||
tabController.addListener(() {
|
||||
if (!tabController.indexIsChanging) {
|
||||
// Your code goes here.
|
||||
|
||||
@@ -44,7 +44,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
child: Form(
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
onChanged: () {
|
||||
Form.of(primaryFocus!.context!)!.save();
|
||||
Form.of(primaryFocus!.context!).save();
|
||||
},
|
||||
child: Wrap(
|
||||
children: List<Widget>.generate(5, (int index) {
|
||||
|
||||
Reference in New Issue
Block a user