Unverified Commit d2858f00 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

enable null_check_on_nullable_type_parameter and tighten_type_of_initializing_formals (#67557)

* enable null_check_on_nullable_type_parameter and tighten_type_of_initializing_formals

* fix CI
parent 0d8d4f77
...@@ -123,6 +123,7 @@ linter: ...@@ -123,6 +123,7 @@ linter:
# - no_logic_in_create_state # not yet tested # - no_logic_in_create_state # not yet tested
# - no_runtimeType_toString # not yet tested # - no_runtimeType_toString # not yet tested
- non_constant_identifier_names - non_constant_identifier_names
- null_check_on_nullable_type_parameter
# - null_closures # not yet tested # - null_closures # not yet tested
# - omit_local_variable_types # opposite of always_specify_types # - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives # - one_member_abstracts # too many false positives
...@@ -180,6 +181,7 @@ linter: ...@@ -180,6 +181,7 @@ linter:
- sort_unnamed_constructors_first - sort_unnamed_constructors_first
- test_types_in_equals - test_types_in_equals
- throw_in_finally - throw_in_finally
- tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types # - type_annotate_public_apis # subset of always_specify_types
- type_init_formals - type_init_formals
# - unawaited_futures # too many false positives # - unawaited_futures # too many false positives
......
...@@ -491,8 +491,11 @@ class TrainHoppingAnimation extends Animation<double> ...@@ -491,8 +491,11 @@ class TrainHoppingAnimation extends Animation<double>
/// The current train argument must not be null but the next train argument /// The current train argument must not be null but the next train argument
/// can be null. If the next train is null, then this object will just proxy /// can be null. If the next train is null, then this object will just proxy
/// the first animation and never hop. /// the first animation and never hop.
TrainHoppingAnimation(this._currentTrain, this._nextTrain, { this.onSwitchedTrain }) TrainHoppingAnimation(
: assert(_currentTrain != null) { Animation<double> this._currentTrain,
this._nextTrain, {
this.onSwitchedTrain,
}) : assert(_currentTrain != null) {
if (_nextTrain != null) { if (_nextTrain != null) {
if (_currentTrain!.value == _nextTrain!.value) { if (_currentTrain!.value == _nextTrain!.value) {
_currentTrain = _nextTrain; _currentTrain = _nextTrain;
......
...@@ -169,12 +169,12 @@ class MaterialApp extends StatefulWidget { ...@@ -169,12 +169,12 @@ class MaterialApp extends StatefulWidget {
this.navigatorKey, this.navigatorKey,
this.scaffoldMessengerKey, this.scaffoldMessengerKey,
this.home, this.home,
this.routes = const <String, WidgetBuilder>{}, Map<String, WidgetBuilder> this.routes = const <String, WidgetBuilder>{},
this.initialRoute, this.initialRoute,
this.onGenerateRoute, this.onGenerateRoute,
this.onGenerateInitialRoutes, this.onGenerateInitialRoutes,
this.onUnknownRoute, this.onUnknownRoute,
this.navigatorObservers = const <NavigatorObserver>[], List<NavigatorObserver> this.navigatorObservers = const <NavigatorObserver>[],
this.builder, this.builder,
this.title = '', this.title = '',
this.onGenerateTitle, this.onGenerateTitle,
...@@ -218,8 +218,8 @@ class MaterialApp extends StatefulWidget { ...@@ -218,8 +218,8 @@ class MaterialApp extends StatefulWidget {
Key? key, Key? key,
this.scaffoldMessengerKey, this.scaffoldMessengerKey,
this.routeInformationProvider, this.routeInformationProvider,
required this.routeInformationParser, required RouteInformationParser<Object> this.routeInformationParser,
required this.routerDelegate, required RouterDelegate<Object> this.routerDelegate,
this.backButtonDispatcher, this.backButtonDispatcher,
this.builder, this.builder,
this.title = '', this.title = '',
......
...@@ -3736,7 +3736,7 @@ class InputDecorationTheme with Diagnosticable { ...@@ -3736,7 +3736,7 @@ class InputDecorationTheme with Diagnosticable {
/// true and bordered per the [border]. /// true and bordered per the [border].
/// ///
/// This property is false by default. /// This property is false by default.
final bool? filled; final bool filled;
/// The color to fill the decoration's container with, if [filled] is true. /// The color to fill the decoration's container with, if [filled] is true.
/// ///
......
...@@ -224,7 +224,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> { ...@@ -224,7 +224,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
return TextFormField( return TextFormField(
decoration: InputDecoration( decoration: InputDecoration(
border: inputTheme.border ?? const UnderlineInputBorder(), border: inputTheme.border ?? const UnderlineInputBorder(),
filled: inputTheme.filled ?? true, filled: inputTheme.filled,
hintText: widget.fieldHintText ?? localizations.dateHelpText, hintText: widget.fieldHintText ?? localizations.dateHelpText,
labelText: widget.fieldLabelText ?? localizations.dateInputLabel, labelText: widget.fieldLabelText ?? localizations.dateInputLabel,
), ),
......
...@@ -235,7 +235,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> { ...@@ -235,7 +235,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
controller: _startController, controller: _startController,
decoration: InputDecoration( decoration: InputDecoration(
border: inputTheme.border ?? const UnderlineInputBorder(), border: inputTheme.border ?? const UnderlineInputBorder(),
filled: inputTheme.filled ?? true, filled: inputTheme.filled,
hintText: widget.fieldStartHintText ?? localizations.dateHelpText, hintText: widget.fieldStartHintText ?? localizations.dateHelpText,
labelText: widget.fieldStartLabelText ?? localizations.dateRangeStartLabel, labelText: widget.fieldStartLabelText ?? localizations.dateRangeStartLabel,
errorText: _startErrorText, errorText: _startErrorText,
...@@ -251,7 +251,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> { ...@@ -251,7 +251,7 @@ class InputDateRangePickerState extends State<InputDateRangePicker> {
controller: _endController, controller: _endController,
decoration: InputDecoration( decoration: InputDecoration(
border: inputTheme.border ?? const UnderlineInputBorder(), border: inputTheme.border ?? const UnderlineInputBorder(),
filled: inputTheme.filled ?? true, filled: inputTheme.filled,
hintText: widget.fieldEndHintText ?? localizations.dateHelpText, hintText: widget.fieldEndHintText ?? localizations.dateHelpText,
labelText: widget.fieldEndLabelText ?? localizations.dateRangeEndLabel, labelText: widget.fieldEndLabelText ?? localizations.dateRangeEndLabel,
errorText: _endErrorText, errorText: _endErrorText,
......
...@@ -174,7 +174,7 @@ class SelectableText extends StatefulWidget { ...@@ -174,7 +174,7 @@ class SelectableText extends StatefulWidget {
/// must not be null. If specified, the [maxLines] argument must be greater /// must not be null. If specified, the [maxLines] argument must be greater
/// than zero. /// than zero.
const SelectableText( const SelectableText(
this.data, { String this.data, {
Key? key, Key? key,
this.focusNode, this.focusNode,
this.style, this.style,
...@@ -226,7 +226,7 @@ class SelectableText extends StatefulWidget { ...@@ -226,7 +226,7 @@ class SelectableText extends StatefulWidget {
/// ///
/// The [autofocus] and [dragStartBehavior] arguments must not be null. /// The [autofocus] and [dragStartBehavior] arguments must not be null.
const SelectableText.rich( const SelectableText.rich(
this.textSpan, { TextSpan this.textSpan, {
Key? key, Key? key,
this.focusNode, this.focusNode,
this.style, this.style,
......
...@@ -177,7 +177,7 @@ class MouseTrackerUpdateDetails with Diagnosticable { ...@@ -177,7 +177,7 @@ class MouseTrackerUpdateDetails with Diagnosticable {
const MouseTrackerUpdateDetails.byNewFrame({ const MouseTrackerUpdateDetails.byNewFrame({
required this.lastAnnotations, required this.lastAnnotations,
required this.nextAnnotations, required this.nextAnnotations,
required this.previousEvent, required PointerEvent this.previousEvent,
}) : assert(previousEvent != null), }) : assert(previousEvent != null),
assert(lastAnnotations != null), assert(lastAnnotations != null),
assert(nextAnnotations != null), assert(nextAnnotations != null),
......
...@@ -500,7 +500,7 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> { ...@@ -500,7 +500,7 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
@override @override
AsyncSnapshot<T> initial() => initialData == null AsyncSnapshot<T> initial() => initialData == null
? AsyncSnapshot<T>.nothing() ? AsyncSnapshot<T>.nothing()
: AsyncSnapshot<T>.withData(ConnectionState.none, initialData!); : AsyncSnapshot<T>.withData(ConnectionState.none, initialData as T);
@override @override
AsyncSnapshot<T> afterConnected(AsyncSnapshot<T> current) => current.inState(ConnectionState.waiting); AsyncSnapshot<T> afterConnected(AsyncSnapshot<T> current) => current.inState(ConnectionState.waiting);
...@@ -733,7 +733,7 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> { ...@@ -733,7 +733,7 @@ class _FutureBuilderState<T> extends State<FutureBuilder<T>> {
super.initState(); super.initState();
_snapshot = widget.initialData == null _snapshot = widget.initialData == null
? AsyncSnapshot<T>.nothing() ? AsyncSnapshot<T>.nothing()
: AsyncSnapshot<T>.withData(ConnectionState.none, widget.initialData!); : AsyncSnapshot<T>.withData(ConnectionState.none, widget.initialData as T);
_subscribe(); _subscribe();
} }
......
...@@ -27,9 +27,9 @@ class DisposableBuildContext<T extends State> { ...@@ -27,9 +27,9 @@ class DisposableBuildContext<T extends State> {
/// Creators must call [dispose] when the [State] is disposed. /// Creators must call [dispose] when the [State] is disposed.
/// ///
/// The [State] must not be null, and [State.mounted] must be true. /// The [State] must not be null, and [State.mounted] must be true.
DisposableBuildContext(this._state) DisposableBuildContext(T this._state)
: assert(_state != null), : assert(_state != null),
assert(_state!.mounted, 'A DisposableBuildContext was given a BuildContext for an Element that is not mounted.'); assert(_state.mounted, 'A DisposableBuildContext was given a BuildContext for an Element that is not mounted.');
T? _state; T? _state;
......
...@@ -20,7 +20,7 @@ class PrimaryScrollController extends InheritedWidget { ...@@ -20,7 +20,7 @@ class PrimaryScrollController extends InheritedWidget {
/// Creates a widget that associates a [ScrollController] with a subtree. /// Creates a widget that associates a [ScrollController] with a subtree.
const PrimaryScrollController({ const PrimaryScrollController({
Key? key, Key? key,
required this.controller, required ScrollController this.controller,
required Widget child, required Widget child,
}) : assert(controller != null), }) : assert(controller != null),
super(key: key, child: child); super(key: key, child: child);
......
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