Skip to content

Commit e454658

Browse files
authored
enable always_require_non_null_named_parameters lint (flutter#9948)
* enable always_require_non_null_named_parameters lint * Update home.dart
1 parent 1f0b2d8 commit e454658

File tree

7 files changed

+23
-17
lines changed

7 files changed

+23
-17
lines changed

.analysis_options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ linter:
6767
# === style rules ===
6868
- always_declare_return_types
6969
# - always_put_control_body_on_new_line # not yet tested
70-
# - always_require_non_null_named_parameters # not yet tested
70+
- always_require_non_null_named_parameters
7171
- always_specify_types
7272
- annotate_overrides
7373
# - avoid_annotating_with_dynamic # not yet tested

.analysis_options_repo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ linter:
6565
# === style rules ===
6666
- always_declare_return_types
6767
# - always_put_control_body_on_new_line # not yet tested
68-
# - always_require_non_null_named_parameters # not yet tested
68+
- always_require_non_null_named_parameters
6969
- always_specify_types
7070
- annotate_overrides
7171
# - avoid_annotating_with_dynamic # not yet tested

examples/catalog/lib/animated_list.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import 'package:flutter/material.dart';
2020
class CardItem extends StatelessWidget {
2121
CardItem({
2222
Key key,
23-
this.animation,
23+
@required this.animation,
2424
this.onTap,
25-
this.item,
25+
@required this.item,
2626
this.selected: false
2727
}) : super(key: key) {
2828
assert(animation != null);

examples/flutter_gallery/lib/demo/animation/home.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,11 @@ class _AllSectionsView extends AnimatedWidget {
371371
// app bar's height is _kAppBarMidHeight and only one section heading is
372372
// visible.
373373
class _SnappingScrollPhysics extends ClampingScrollPhysics {
374-
_SnappingScrollPhysics({ ScrollPhysics parent, this.midScrollOffset }) : super(parent: parent) {
375-
assert(midScrollOffset != null);
376-
}
374+
_SnappingScrollPhysics({
375+
ScrollPhysics parent,
376+
@required this.midScrollOffset,
377+
}) : assert(midScrollOffset != null),
378+
super(parent: parent);
377379

378380
final double midScrollOffset;
379381

packages/flutter/lib/src/gestures/velocity_tracker.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import 'dart:ui' show Offset;
66

7+
import 'package:flutter/foundation.dart';
8+
79
import 'lsq_solver.dart';
810

911
export 'dart:ui' show Offset;
@@ -13,7 +15,9 @@ class Velocity {
1315
/// Creates a velocity.
1416
///
1517
/// The [pixelsPerSecond] argument must not be null.
16-
const Velocity({ this.pixelsPerSecond }) : assert(pixelsPerSecond != null);
18+
const Velocity({
19+
@required this.pixelsPerSecond,
20+
}) : assert(pixelsPerSecond != null);
1721

1822
/// A velocity that isn't moving at all.
1923
static const Velocity zero = const Velocity(pixelsPerSecond: Offset.zero);
@@ -90,10 +94,10 @@ class VelocityEstimate {
9094
///
9195
/// [pixelsPerSecond], [confidence], [duration], and [offset] must not be null.
9296
const VelocityEstimate({
93-
this.pixelsPerSecond,
94-
this.confidence,
95-
this.duration,
96-
this.offset,
97+
@required this.pixelsPerSecond,
98+
@required this.confidence,
99+
@required this.duration,
100+
@required this.offset,
97101
}) : assert(pixelsPerSecond != null),
98102
assert(confidence != null),
99103
assert(duration != null),

packages/flutter/lib/src/material/data_table.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class DataRow {
9191
this.key,
9292
this.selected: false,
9393
this.onSelectChanged,
94-
this.cells
94+
@required this.cells
9595
}) : assert(cells != null);
9696

9797
/// Creates the configuration for a row of a [DataTable], deriving
@@ -102,7 +102,7 @@ class DataRow {
102102
int index,
103103
this.selected: false,
104104
this.onSelectChanged,
105-
this.cells
105+
@required this.cells
106106
}) : assert(cells != null),
107107
key = new ValueKey<int>(index);
108108

packages/flutter/lib/src/painting/box_painter.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ class LinearGradient extends Gradient {
786786
const LinearGradient({
787787
this.begin: FractionalOffset.centerLeft,
788788
this.end: FractionalOffset.centerRight,
789-
this.colors,
789+
@required this.colors,
790790
this.stops,
791791
this.tileMode: TileMode.clamp,
792792
}) : assert(begin != null),
@@ -1000,7 +1000,7 @@ class RadialGradient extends Gradient {
10001000
const RadialGradient({
10011001
this.center: FractionalOffset.center,
10021002
this.radius: 0.5,
1003-
this.colors,
1003+
@required this.colors,
10041004
this.stops,
10051005
this.tileMode: TileMode.clamp,
10061006
}) : assert(center != null),
@@ -1262,7 +1262,7 @@ class DecorationImage {
12621262
///
12631263
/// The [image] argument must not be null.
12641264
const DecorationImage({
1265-
this.image,
1265+
@required this.image,
12661266
this.fit,
12671267
this.repeat: ImageRepeat.noRepeat,
12681268
this.centerSlice,

0 commit comments

Comments
 (0)