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