Skip to content

Commit f41b341

Browse files
committed
Merge pull request #2639 from Hixie/always_specify_types
Almost enable always_specify_types lint
2 parents e33d8d9 + d162d98 commit f41b341

113 files changed

Lines changed: 772 additions & 691 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dev/manual_tests/card_collection.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class CardCollectionState extends State<CardCollection> {
2626
const TextStyle(color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold);
2727

2828
// TODO(hansmuller): need a local image asset
29-
static const _sunshineURL = "http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg";
29+
static const String _sunshineURL = "http://www.walltor.com/images/wallpaper/good-morning-sunshine-58540.jpg";
3030

31-
static const kCardMargins = 8.0;
31+
static const double kCardMargins = 8.0;
3232

3333
final TextStyle backgroundTextStyle =
3434
Typography.white.title.copyWith(textAlign: TextAlign.center);

dev/manual_tests/pageable_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PageableListAppState extends State<PageableListApp> {
2323
List<Size> cardSizes = [
2424
[100.0, 300.0], [300.0, 100.0], [200.0, 400.0], [400.0, 400.0], [300.0, 400.0]
2525
]
26-
.map((args) => new Size(args[0], args[1]))
26+
.map((List<double> args) => new Size(args[0], args[1]))
2727
.toList();
2828

2929
cardModels = new List<CardModel>.generate(cardSizes.length, (int i) {

examples/layers/services/media_service.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class PianoKey {
3939
player.ptr.pause();
4040
}
4141

42-
Future load(MediaServiceProxy mediaService) async {
42+
Future<Null> load(MediaServiceProxy mediaService) async {
4343
try {
4444
mediaService.ptr.createPlayer(player);
4545
UrlResponse response = await fetchUrl(soundUrl);
@@ -61,11 +61,11 @@ class PianoApp extends StatelessComponent {
6161
new PianoKey(Colors.purple[500], iLoveYou),
6262
];
6363

64-
Future loadSounds() async {
64+
Future<Null> loadSounds() async {
6565
MediaServiceProxy mediaService = new MediaServiceProxy.unbound();
6666
try {
6767
shell.connectToService("mojo:media_service", mediaService);
68-
List<Future<MediaPlayerPrepareResponseParams>> pending = <Future<MediaPlayerPrepareResponseParams>>[];
68+
List<Future<Null>> pending = <Future<Null>>[];
6969
for (PianoKey key in keys)
7070
pending.add(key.load(mediaService));
7171
await Future.wait(pending);
@@ -93,8 +93,8 @@ class PianoApp extends StatelessComponent {
9393
}
9494

9595
Widget statusBox(Widget child) {
96-
const mediumGray = const Color(0xff555555);
97-
const darkGray = const Color(0xff222222);
96+
const Color mediumGray = const Color(0xff555555);
97+
const Color darkGray = const Color(0xff222222);
9898
return new Center(
9999
child: new Container(
100100
decoration: const BoxDecoration(
@@ -121,7 +121,7 @@ Widget splashScreen() {
121121
);
122122
}
123123

124-
Future main() async {
124+
Future<Null> main() async {
125125
runApp(splashScreen());
126126

127127
PianoApp app = new PianoApp();

examples/material_gallery/lib/demo/buttons_demo.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
8080
tooltip: 'Open FAB demos',
8181
child: new Icon(icon: Icons.add),
8282
onPressed: () {
83-
Navigator.push(context, new MaterialPageRoute(
83+
Navigator.push(context, new MaterialPageRoute<Null>(
8484
builder: (BuildContext context) => new TabsFabDemo()
8585
));
8686
}
@@ -97,7 +97,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
9797
new RaisedButton(
9898
child: new Text("Launch Demo"),
9999
onPressed: () {
100-
Navigator.push(context, new MaterialPageRoute(
100+
Navigator.push(context, new MaterialPageRoute<Null>(
101101
builder: (BuildContext context) => new SnackBarDemo()
102102
));
103103
}
@@ -127,7 +127,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
127127
new FlatButton(
128128
child: new Text("Launch Demo"),
129129
onPressed: () {
130-
Navigator.push(context, new MaterialPageRoute(
130+
Navigator.push(context, new MaterialPageRoute<Null>(
131131
builder: (_) => new DialogDemo()
132132
));
133133
}
@@ -200,10 +200,10 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
200200
center: new Text("Buttons"),
201201
tabBar: new TabBar<_ButtonDemo>(
202202
isScrollable: true,
203-
labels: new Map.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel)
203+
labels: new Map<_ButtonDemo, TabLabel>.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel)
204204
)
205205
),
206-
body: new TabBarView(
206+
body: new TabBarView<_ButtonDemo>(
207207
children: demos.map(buildTabView).toList()
208208
)
209209
)

examples/material_gallery/lib/demo/colors_demo.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class ColorSwatchTabView extends StatelessComponent {
7777
}
7878

7979
final ColorSwatch swatch;
80-
final blackTextStyle = Typography.black.body1;
81-
final whiteTextStyle = Typography.white.body1;
80+
final TextStyle blackTextStyle = Typography.black.body1;
81+
final TextStyle whiteTextStyle = Typography.white.body1;
8282

8383
Widget build(BuildContext context) {
8484
List<Widget> colorItems = swatch.colors.keys.map((int index) {
@@ -116,12 +116,12 @@ class ColorsDemo extends StatelessComponent {
116116
center: new Text("Colors"),
117117
tabBar: new TabBar<ColorSwatch>(
118118
isScrollable: true,
119-
labels: new Map.fromIterable(colorSwatches, value: (ColorSwatch swatch) {
119+
labels: new Map<ColorSwatch, TabLabel>.fromIterable(colorSwatches, value: (ColorSwatch swatch) {
120120
return new TabLabel(text: swatch.name);
121121
})
122122
)
123123
),
124-
body: new TabBarView(
124+
body: new TabBarView<ColorSwatch>(
125125
children: colorSwatches.map((ColorSwatch swatch) {
126126
return new ColorSwatchTabView(swatch: swatch);
127127
})

examples/material_gallery/lib/demo/date_picker_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DatePickerDemo extends StatefulComponent {
1414
class _DatePickerDemoState extends State<DatePickerDemo> {
1515
DateTime _selectedDate = new DateTime.now();
1616

17-
Future _handleSelectDate() async {
17+
Future<Null> _handleSelectDate() async {
1818
DateTime picked = await showDatePicker(
1919
context: context,
2020
initialDate: _selectedDate,

examples/material_gallery/lib/demo/dialog_demo.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ class DialogDemo extends StatefulComponent {
6060
class DialogDemoState extends State<DialogDemo> {
6161
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
6262

63-
void showDemoDialog({ BuildContext context, Dialog dialog }) {
64-
showDialog(
63+
void showDemoDialog/*<T>*/({ BuildContext context, Dialog dialog }) {
64+
showDialog/*<T>*/(
6565
context: context,
6666
child: dialog
6767
)
68-
.then((dynamic value) { // The value passed to Navigator.pop() or null.
68+
.then((dynamic/*=T*/ value) { // The value passed to Navigator.pop() or null.
6969
if (value != null) {
7070
scaffoldKey.currentState.showSnackBar(new SnackBar(
7171
content: new Text('You selected: $value')
@@ -89,7 +89,7 @@ class DialogDemoState extends State<DialogDemo> {
8989
new RaisedButton(
9090
child: new Text('ALERT'),
9191
onPressed: () {
92-
showDemoDialog(
92+
showDemoDialog/*<DialogDemoAction>*/(
9393
context: context,
9494
dialog: new Dialog(
9595
content: new Text(
@@ -113,7 +113,7 @@ class DialogDemoState extends State<DialogDemo> {
113113
new RaisedButton(
114114
child: new Text('ALERT WITH TITLE'),
115115
onPressed: () {
116-
showDemoDialog(
116+
showDemoDialog/*<DialogDemoAction>*/(
117117
context: context,
118118
dialog: new Dialog(
119119
title: new Text("Use Google's location service?"),
@@ -138,7 +138,7 @@ class DialogDemoState extends State<DialogDemo> {
138138
new RaisedButton(
139139
child: new Text('SIMPLE'),
140140
onPressed: () {
141-
showDemoDialog(
141+
showDemoDialog/*<String>*/(
142142
context: context,
143143
dialog: new Dialog(
144144
title: new Text('Set backup account'),
@@ -174,7 +174,7 @@ class DialogDemoState extends State<DialogDemo> {
174174
context: context,
175175
initialTime: const TimeOfDay(hour: 15, minute: 30)
176176
)
177-
.then((value) { // The value passed to Navigator.pop() or null.
177+
.then((TimeOfDay value) { // The value passed to Navigator.pop() or null.
178178
if (value != null) {
179179
scaffoldKey.currentState.showSnackBar(new SnackBar(
180180
content: new Text('You selected: $value')
@@ -186,7 +186,7 @@ class DialogDemoState extends State<DialogDemo> {
186186
new RaisedButton(
187187
child: new Text('FULLSCREEN'),
188188
onPressed: () {
189-
Navigator.push(context, new MaterialPageRoute(
189+
Navigator.push(context, new MaterialPageRoute<Null>(
190190
builder: (BuildContext context) => new FullScreenDialogDemo()
191191
));
192192
}

examples/material_gallery/lib/demo/fitness_demo.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class _FitnessDemoContents extends StatefulComponent {
3333

3434
class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
3535

36-
Future _loadAssets(AssetBundle bundle) async {
36+
Future<Null> _loadAssets(AssetBundle bundle) async {
3737
_images = new ImageMap(bundle);
3838
await _images.load(<String>[
3939
'packages/flutter_gallery_assets/jumpingjack.png',
@@ -267,9 +267,9 @@ class _WorkoutAnimationNode extends NodeWithSize {
267267
class _ProgressCircle extends NodeWithSize {
268268
_ProgressCircle(Size size, [this.value = 0.0]) : super(size);
269269

270-
static const _kTwoPI = math.PI * 2.0;
271-
static const _kEpsilon = .0000001;
272-
static const _kSweep = _kTwoPI - _kEpsilon;
270+
static const double _kTwoPI = math.PI * 2.0;
271+
static const double _kEpsilon = .0000001;
272+
static const double _kSweep = _kTwoPI - _kEpsilon;
273273

274274
double value;
275275

examples/material_gallery/lib/demo/grid_list_demo.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class GridDemoPhotoItem extends StatelessComponent {
3838
final GridDemoTileStyle tileStyle;
3939

4040
void showPhoto(BuildContext context) {
41-
Navigator.push(context, new MaterialPageRoute(
41+
Navigator.push(context, new MaterialPageRoute<Null>(
4242
builder: (BuildContext context) {
4343
return new Scaffold(
4444
toolBar: new ToolBar(
@@ -138,7 +138,7 @@ class GridListDemoState extends State<GridListDemo> {
138138
GridDemoTileStyle tileStyle = GridDemoTileStyle.twoLine;
139139

140140
void showTileStyleMenu(BuildContext context) {
141-
final List<PopupMenuItem> items = <PopupMenuItem<GridDemoTileStyle>>[
141+
final List<PopupMenuItem<GridDemoTileStyle>> items = <PopupMenuItem<GridDemoTileStyle>>[
142142
new PopupMenuItem<GridDemoTileStyle>(
143143
value: GridDemoTileStyle.imageOnly,
144144
child: new Text('Image only')

examples/material_gallery/lib/demo/leave_behind_demo.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
3737
List<LeaveBehindItem> leaveBehindItems;
3838

3939
void initListItems() {
40-
leaveBehindItems = new List.generate(16, (int index) {
40+
leaveBehindItems = new List<LeaveBehindItem>.generate(16, (int index) {
4141
return new LeaveBehindItem(
4242
index: index,
4343
name: 'Item $index Sender',
@@ -130,7 +130,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
130130
right: <Widget>[
131131
new PopupMenuButton<LeaveBehindDemoAction>(
132132
onSelected: handleDemoAction,
133-
items: <PopupMenuEntry>[
133+
items: <PopupMenuEntry<LeaveBehindDemoAction>>[
134134
new PopupMenuItem<LeaveBehindDemoAction>(
135135
value: LeaveBehindDemoAction.reset,
136136
child: new Text('Reset the list')

0 commit comments

Comments
 (0)