remove some stray nullOK mentions from docs (#74661)
This commit is contained in:
committed by
GitHub
parent
4ba184d434
commit
b400534dc7
@@ -24,12 +24,14 @@ enum CupertinoUserInterfaceLevelData {
|
||||
/// the given data.
|
||||
///
|
||||
/// Querying the current elevation status using [CupertinoUserInterfaceLevel.of]
|
||||
/// will cause your widget to rebuild automatically whenever the [CupertinoUserInterfaceLevelData]
|
||||
/// changes.
|
||||
/// will cause your widget to rebuild automatically whenever the
|
||||
/// [CupertinoUserInterfaceLevelData] changes.
|
||||
///
|
||||
/// If no [CupertinoUserInterfaceLevel] is in scope then the [CupertinoUserInterfaceLevel.of]
|
||||
/// method will throw an exception, unless the `nullOk` argument is set to true,
|
||||
/// in which case it returns null.
|
||||
/// If no [CupertinoUserInterfaceLevel] is in scope then the
|
||||
/// [CupertinoUserInterfaceLevel.of] method will throw an exception.
|
||||
/// Alternatively, [CupertinoUserInterfaceLevel.maybeOf] can be used, which
|
||||
/// returns null instead of throwing if no [CupertinoUserInterfaceLevel] is in
|
||||
/// scope.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
|
||||
@@ -1199,18 +1199,16 @@ class _MasterDetailFlow extends StatefulWidget {
|
||||
/// ```dart
|
||||
/// _MasterDetailFlow.of(context).openDetailPage(arguments);
|
||||
/// ```
|
||||
static _MasterDetailFlowProxy? of(
|
||||
BuildContext context, {
|
||||
bool nullOk = false,
|
||||
}) {
|
||||
static _MasterDetailFlowProxy? of(BuildContext context) {
|
||||
_PageOpener? pageOpener = context.findAncestorStateOfType<_MasterDetailScaffoldState>();
|
||||
pageOpener ??= context.findAncestorStateOfType<_MasterDetailFlowState>();
|
||||
assert(() {
|
||||
if (pageOpener == null && !nullOk) {
|
||||
if (pageOpener == null) {
|
||||
throw FlutterError(
|
||||
'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'
|
||||
' that of a widget that is a descendant of a Master Detail Flow widget.');
|
||||
'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 '
|
||||
'that of a widget that is a descendant of a Master Detail Flow widget.'
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
|
||||
@@ -2796,8 +2796,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
// nullOk is valid here since both the Scaffold and ScaffoldMessenger are
|
||||
// currently available for managing SnackBars.
|
||||
// Using maybeOf is valid here since both the Scaffold and ScaffoldMessenger
|
||||
// are currently available for managing SnackBars.
|
||||
final ScaffoldMessengerState? _currentScaffoldMessenger = ScaffoldMessenger.maybeOf(context);
|
||||
// If our ScaffoldMessenger has changed, unregister with the old one first.
|
||||
if (_scaffoldMessenger != null &&
|
||||
|
||||
@@ -31,8 +31,8 @@ enum Orientation {
|
||||
/// window, use `MediaQuery.of(context).size`.
|
||||
///
|
||||
/// 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
|
||||
/// returns null.
|
||||
/// exception. Alternatively, [MediaQuery.maybeOf] may be used, which returns
|
||||
/// null instead of throwing if no [MediaQuery] is in scope.
|
||||
///
|
||||
/// ## Insets and Padding
|
||||
///
|
||||
@@ -629,8 +629,8 @@ class MediaQueryData {
|
||||
/// user rotates their device).
|
||||
///
|
||||
/// 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
|
||||
/// returns null.
|
||||
/// exception. Alternatively, [MediaQuery.maybeOf] may be used, which returns
|
||||
/// null instead of throwing if no [MediaQuery] is in scope.
|
||||
///
|
||||
/// {@youtube 560 315 https://www.youtube.com/watch?v=A3WrA4zAaPw}
|
||||
///
|
||||
|
||||
@@ -88,7 +88,6 @@ void main() {
|
||||
Router<dynamic>? router = Router.maybeOf(textContext);
|
||||
expect(router, isNull);
|
||||
|
||||
// Test when the nullOk is not specified.
|
||||
bool hasFlutterError = false;
|
||||
try {
|
||||
router = Router.of(textContext);
|
||||
|
||||
Reference in New Issue
Block a user