Unverified Commit b400534d authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

remove some stray nullOK mentions from docs (#74661)

parent 4ba184d4
...@@ -24,12 +24,14 @@ enum CupertinoUserInterfaceLevelData { ...@@ -24,12 +24,14 @@ enum CupertinoUserInterfaceLevelData {
/// the given data. /// the given data.
/// ///
/// Querying the current elevation status using [CupertinoUserInterfaceLevel.of] /// Querying the current elevation status using [CupertinoUserInterfaceLevel.of]
/// will cause your widget to rebuild automatically whenever the [CupertinoUserInterfaceLevelData] /// will cause your widget to rebuild automatically whenever the
/// changes. /// [CupertinoUserInterfaceLevelData] changes.
/// ///
/// If no [CupertinoUserInterfaceLevel] is in scope then the [CupertinoUserInterfaceLevel.of] /// If no [CupertinoUserInterfaceLevel] is in scope then the
/// method will throw an exception, unless the `nullOk` argument is set to true, /// [CupertinoUserInterfaceLevel.of] method will throw an exception.
/// in which case it returns null. /// Alternatively, [CupertinoUserInterfaceLevel.maybeOf] can be used, which
/// returns null instead of throwing if no [CupertinoUserInterfaceLevel] is in
/// scope.
/// ///
/// See also: /// See also:
/// ///
......
...@@ -1199,18 +1199,16 @@ class _MasterDetailFlow extends StatefulWidget { ...@@ -1199,18 +1199,16 @@ class _MasterDetailFlow extends StatefulWidget {
/// ```dart /// ```dart
/// _MasterDetailFlow.of(context).openDetailPage(arguments); /// _MasterDetailFlow.of(context).openDetailPage(arguments);
/// ``` /// ```
static _MasterDetailFlowProxy? of( static _MasterDetailFlowProxy? of(BuildContext context) {
BuildContext context, {
bool nullOk = false,
}) {
_PageOpener? pageOpener = context.findAncestorStateOfType<_MasterDetailScaffoldState>(); _PageOpener? pageOpener = context.findAncestorStateOfType<_MasterDetailScaffoldState>();
pageOpener ??= context.findAncestorStateOfType<_MasterDetailFlowState>(); pageOpener ??= context.findAncestorStateOfType<_MasterDetailFlowState>();
assert(() { assert(() {
if (pageOpener == null && !nullOk) { if (pageOpener == null) {
throw FlutterError( throw FlutterError(
'Master Detail operation requested with a context that does not include a Master Detail' 'Master Detail operation requested with a context that does not include a Master Detail '
' Flow.\nThe context used to open a detail page from the Master Detail Flow must be' 'Flow.\nThe context used to open a detail page from the Master Detail Flow must be '
' that of a widget that is a descendant of a Master Detail Flow widget.'); 'that of a widget that is a descendant of a Master Detail Flow widget.'
);
} }
return true; return true;
}()); }());
......
...@@ -2796,8 +2796,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto ...@@ -2796,8 +2796,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// nullOk is valid here since both the Scaffold and ScaffoldMessenger are // Using maybeOf is valid here since both the Scaffold and ScaffoldMessenger
// currently available for managing SnackBars. // are currently available for managing SnackBars.
final ScaffoldMessengerState? _currentScaffoldMessenger = ScaffoldMessenger.maybeOf(context); final ScaffoldMessengerState? _currentScaffoldMessenger = ScaffoldMessenger.maybeOf(context);
// If our ScaffoldMessenger has changed, unregister with the old one first. // If our ScaffoldMessenger has changed, unregister with the old one first.
if (_scaffoldMessenger != null && if (_scaffoldMessenger != null &&
......
...@@ -31,8 +31,8 @@ enum Orientation { ...@@ -31,8 +31,8 @@ enum Orientation {
/// window, use `MediaQuery.of(context).size`. /// window, use `MediaQuery.of(context).size`.
/// ///
/// If no [MediaQuery] is in scope then the [MediaQuery.of] method will throw an /// If no [MediaQuery] is in scope then the [MediaQuery.of] method will throw an
/// exception, unless the `nullOk` argument is set to true, in which case it /// exception. Alternatively, [MediaQuery.maybeOf] may be used, which returns
/// returns null. /// null instead of throwing if no [MediaQuery] is in scope.
/// ///
/// ## Insets and Padding /// ## Insets and Padding
/// ///
...@@ -629,8 +629,8 @@ class MediaQueryData { ...@@ -629,8 +629,8 @@ class MediaQueryData {
/// user rotates their device). /// user rotates their device).
/// ///
/// If no [MediaQuery] is in scope then the [MediaQuery.of] method will throw an /// If no [MediaQuery] is in scope then the [MediaQuery.of] method will throw an
/// exception, unless the `nullOk` argument is set to true, in which case it /// exception. Alternatively, [MediaQuery.maybeOf] may be used, which returns
/// returns null. /// null instead of throwing if no [MediaQuery] is in scope.
/// ///
/// {@youtube 560 315 https://www.youtube.com/watch?v=A3WrA4zAaPw} /// {@youtube 560 315 https://www.youtube.com/watch?v=A3WrA4zAaPw}
/// ///
......
...@@ -88,7 +88,6 @@ void main() { ...@@ -88,7 +88,6 @@ void main() {
Router<dynamic>? router = Router.maybeOf(textContext); Router<dynamic>? router = Router.maybeOf(textContext);
expect(router, isNull); expect(router, isNull);
// Test when the nullOk is not specified.
bool hasFlutterError = false; bool hasFlutterError = false;
try { try {
router = Router.of(textContext); router = Router.of(textContext);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment