Visitar URL original
Remove 'must be non-null' and 'must not be null' comments in widgets library by gspencergoog · Pull Request #134992 · flutter/flutter · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix instances of 'cannot be null'
  • Loading branch information
gspencergoog committed Sep 19, 2023
commit dcb223a5b1b4583c8444b98ace2c2584da2a7381
10 changes: 4 additions & 6 deletions packages/flutter/lib/src/widgets/editable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ class EditableText extends StatefulWidget {
/// copied with copy or cut. If [readOnly] is also true, then the text cannot
/// be selected.
///
/// Defaults to false. Cannot be null.
/// Defaults to false.
/// {@endtemplate}
final bool obscureText;

Expand Down Expand Up @@ -953,7 +953,7 @@ class EditableText extends StatefulWidget {
/// {@template flutter.widgets.editableText.autocorrect}
/// Whether to enable autocorrection.
///
/// Defaults to true. Cannot be null.
/// Defaults to true.
/// {@endtemplate}
final bool autocorrect;

Expand Down Expand Up @@ -1009,7 +1009,7 @@ class EditableText extends StatefulWidget {
/// {@template flutter.widgets.editableText.textAlign}
/// How the text should be aligned horizontally.
///
/// Defaults to [TextAlign.start] and cannot be null.
/// Defaults to [TextAlign.start].
/// {@endtemplate}
final TextAlign textAlign;

Expand Down Expand Up @@ -1078,8 +1078,6 @@ class EditableText extends StatefulWidget {
final TextScaler? textScaler;

/// The color to use when painting the cursor.
///
/// Cannot be null.
final Color cursorColor;

/// The color to use when painting the autocorrection Rect.
Expand Down Expand Up @@ -1233,7 +1231,7 @@ class EditableText extends StatefulWidget {
/// If true, the keyboard will open as soon as this text field obtains focus.
/// Otherwise, the keyboard is only shown after the user taps the text field.
///
/// Defaults to false. Cannot be null.
/// Defaults to false.
/// {@endtemplate}
// See https://github.com/flutter/flutter/issues/7035 for the rationale for this
// keyboard behavior.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class FormField<T> extends StatefulWidget {
/// will auto-validate even without user interaction. If
/// [AutovalidateMode.disabled], auto-validation will be disabled.
///
/// Defaults to [AutovalidateMode.disabled], cannot be null.
/// Defaults to [AutovalidateMode.disabled].
/// {@endtemplate}
final AutovalidateMode autovalidateMode;

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/heroes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class Hero extends StatefulWidget {
/// [PageRoute.maintainState] set to true for a gesture triggered hero
/// transition to work.
///
/// Defaults to false and cannot be null.
/// Defaults to false.
final bool transitionOnUserGestures;

// Returns a map of all of the heroes in `context` indexed by hero tag that
Expand Down
7 changes: 3 additions & 4 deletions packages/flutter/lib/src/widgets/interactive_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class InteractiveViewer extends StatefulWidget {
///
/// Defaults to 2.5.
///
/// Cannot be null, and must be greater than zero and greater than minScale.
/// Must be greater than zero and greater than [minScale].
final double maxScale;

/// The minimum allowed scale.
Expand All @@ -317,15 +317,14 @@ class InteractiveViewer extends StatefulWidget {
///
/// Defaults to 0.8.
///
/// Cannot be null, and must be a finite number greater than zero and less
/// than maxScale.
/// Must be a finite number greater than zero and less than [maxScale].
final double minScale;

/// Changes the deceleration behavior after a gesture.
///
/// Defaults to 0.0000135.
///
/// Cannot be null, and must be a finite number greater than zero.
/// Must be a finite number greater than zero.
final double interactionEndFrictionCoefficient;

/// Called when the user ends a pan or scale gesture on the widget.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ class Navigator extends StatefulWidget {
/// The delegate used for deciding how routes transition in or off the screen
/// during the [pages] updates.
///
/// Defaults to [DefaultTransitionDelegate] if not specified, cannot be null.
/// Defaults to [DefaultTransitionDelegate].
final TransitionDelegate<dynamic> transitionDelegate;

/// The name of the first route to show.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/nested_scroll_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class NestedScrollView extends StatefulWidget {
/// outer scrollable over the inner when scrolling back.
///
/// This is useful for an outer scrollable containing a [SliverAppBar] that
/// is expected to float. This cannot be null.
/// is expected to float.
final bool floatHeaderSlivers;

/// {@macro flutter.material.Material.clipBehavior}
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/overscroll_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ class OverscrollIndicatorNotification extends Notification with ViewportNotifica
/// Calling [disallowIndicator] sets this to false, preventing the over scroll
/// indicator from showing.
///
/// Defaults to true, cannot be null.
/// Defaults to true.
bool accepted = true;

/// Call this method if the overscroll indicator should be prevented.
Expand Down
3 changes: 1 addition & 2 deletions packages/flutter/lib/src/widgets/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2168,8 +2168,7 @@ class RawDialogRoute<T> extends PopupRoute<T> {
/// is dimmed with a [ModalBarrier]. The widget returned by the `pageBuilder`
/// does not share a context with the location that [showGeneralDialog] is
/// originally called from. Use a [StatefulBuilder] or a custom
/// [StatefulWidget] if the dialog needs to update dynamically. The
/// `pageBuilder` argument can not be null.
/// [StatefulWidget] if the dialog needs to update dynamically.
///
/// The `context` argument is used to look up the [Navigator] for the
/// dialog. It is only used when the method is called. Its corresponding widget
Expand Down
3 changes: 1 addition & 2 deletions packages/flutter/lib/src/widgets/scrollable_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export 'package:flutter/physics.dart' show Tolerance;
/// information about the Scrollable in order to be initialized.
@immutable
class ScrollableDetails {
/// Creates a set of details describing the [Scrollable]. The [direction]
/// cannot be null.
/// Creates a set of details describing the [Scrollable].
const ScrollableDetails({
required this.direction,
this.controller,
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter/lib/src/widgets/scrollbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
/// Convert between a thumb track position and the corresponding scroll
/// position.
///
/// thumbOffsetLocal is a position in the thumb track. Cannot be null.
/// The `thumbOffsetLocal` argument is a position in the thumb track.
double getTrackToScroll(double thumbOffsetLocal) {
final double scrollableExtent = _lastMetrics!.maxScrollExtent - _lastMetrics!.minScrollExtent;
final double thumbMovableExtent = _traversableTrackExtent - _thumbExtent;
Expand Down Expand Up @@ -1242,18 +1242,18 @@ class RawScrollbar extends StatefulWidget {

/// The [Duration] of the fade animation.
///
/// Cannot be null, defaults to a [Duration] of 300 milliseconds.
/// Defaults to a [Duration] of 300 milliseconds.
final Duration fadeDuration;

/// The [Duration] of time until the fade animation begins.
///
/// Cannot be null, defaults to a [Duration] of 600 milliseconds.
/// Defaults to a [Duration] of 600 milliseconds.
final Duration timeToFade;

/// The [Duration] of time that a LongPress will trigger the drag gesture of
/// the scrollbar thumb.
///
/// Cannot be null, defaults to [Duration.zero].
/// Defaults to [Duration.zero].
final Duration pressDuration;

/// {@template flutter.widgets.Scrollbar.notificationPredicate}
Expand Down
15 changes: 7 additions & 8 deletions packages/flutter/lib/src/widgets/sliver_fill.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class SliverFillViewport extends StatelessWidget {
/// Whether to add padding to both ends of the list.
///
/// If this is set to true and [viewportFraction] < 1.0, padding will be added
/// such that the first and last child slivers will be in the center of
/// the viewport when scrolled all the way to the start or end, respectively.
/// You may want to set this to false if this [SliverFillViewport] is not the only
/// such that the first and last child slivers will be in the center of the
/// viewport when scrolled all the way to the start or end, respectively. You
/// may want to set this to false if this [SliverFillViewport] is not the only
/// widget along this main axis, such as in a [CustomScrollView] with multiple
/// children.
///
/// This option cannot be null. If [viewportFraction] >= 1.0, this option has no
/// effect. Defaults to true.
/// If [viewportFraction] is greater than one, this option has no effect.
/// Defaults to true.
final bool padEnds;

/// {@macro flutter.widgets.SliverMultiBoxAdaptorWidget.delegate}
Expand Down Expand Up @@ -282,10 +282,9 @@ class SliverFillRemaining extends StatelessWidget {

/// Indicates whether the child should stretch to fill the overscroll area
/// created by certain scroll physics, such as iOS' default scroll physics.
/// This value cannot be null. This flag is only relevant when the
/// [hasScrollBody] value is false.
/// This flag is only relevant when [hasScrollBody] is false.
///
/// Defaults to false, meaning the default behavior is for the child to
/// Defaults to false, meaning that the default behavior is for the child to
/// maintain its size and not extend into the overscroll area.
final bool fillOverscroll;

Expand Down