Remove nullOk in MediaQuery.of (#68736)

Adds MediaQuery.maybeOf to replace calling MediaQuery.of(context, nullOk: true), and removes the nullOk parameter. Also changes MediaQuery.of to return a non-nullable value, and removes many instances of the ! operator, reducing the possible places where a null dereference could occur.
This commit is contained in:
Greg Spencer
2020-10-28 07:56:41 -07:00
committed by GitHub
parent 35a94f70e1
commit 55289324c6
78 changed files with 345 additions and 245 deletions

View File

@@ -71,7 +71,7 @@ class AdaptiveContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (MediaQuery.of(context)!.size.width < _kGridViewBreakpoint) {
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
return ListView(
itemExtent: _kListItemExtent,
children: names.map<Widget>((String name) => AdaptedListItem(name: name)).toList(),