Skip to content

Commit 29339b8

Browse files
authored
Remove unneeded types (flutter#949)
1 parent 64805fe commit 29339b8

File tree

30 files changed

+54
-55
lines changed

30 files changed

+54
-55
lines changed

add_to_app/books/flutter_module_books/lib/api.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Book {
1818
Thumbnail? thumbnail;
1919

2020
Object encode() {
21-
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
21+
final pigeonMap = <Object?, Object?>{};
2222
pigeonMap['title'] = title;
2323
pigeonMap['subtitle'] = subtitle;
2424
pigeonMap['author'] = author;
@@ -30,7 +30,7 @@ class Book {
3030
}
3131

3232
static Book decode(Object message) {
33-
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
33+
final pigeonMap = message as Map<Object?, Object?>;
3434
return Book()
3535
..title = pigeonMap['title'] as String?
3636
..subtitle = pigeonMap['subtitle'] as String?
@@ -48,13 +48,13 @@ class Thumbnail {
4848
String? url;
4949

5050
Object encode() {
51-
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
51+
final pigeonMap = <Object?, Object?>{};
5252
pigeonMap['url'] = url;
5353
return pigeonMap;
5454
}
5555

5656
static Thumbnail decode(Object message) {
57-
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
57+
final pigeonMap = message as Map<Object?, Object?>;
5858
return Thumbnail()..url = pigeonMap['url'] as String?;
5959
}
6060
}
@@ -89,7 +89,7 @@ abstract class FlutterBookApi {
8989
void displayBookDetails(Book book);
9090
static void setup(FlutterBookApi? api) {
9191
{
92-
const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
92+
const channel = BasicMessageChannel<Object?>(
9393
'dev.flutter.pigeon.FlutterBookApi.displayBookDetails', codec);
9494
if (api == null) {
9595
channel.setMessageHandler(null);
@@ -146,7 +146,7 @@ class HostBookApi {
146146
static const MessageCodec<Object?> codec = _HostBookApiCodec();
147147

148148
Future<void> cancel() async {
149-
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
149+
final channel = BasicMessageChannel<Object?>(
150150
'dev.flutter.pigeon.HostBookApi.cancel', codec,
151151
binaryMessenger: _binaryMessenger);
152152
final Map<Object?, Object?>? replyMap =
@@ -158,8 +158,7 @@ class HostBookApi {
158158
details: null,
159159
);
160160
} else if (replyMap['error'] != null) {
161-
final Map<Object?, Object?> error =
162-
(replyMap['error'] as Map<Object?, Object?>?)!;
161+
final error = (replyMap['error'] as Map<Object?, Object?>?)!;
163162
throw PlatformException(
164163
code: (error['code'] as String?)!,
165164
message: error['message'] as String?,

add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class _MyHomePageState extends State<MyHomePage> {
7373
body: Center(
7474
child: Column(
7575
mainAxisAlignment: MainAxisAlignment.center,
76-
children: <Widget>[
76+
children: [
7777
const Text(
7878
'You have pushed the button this many times:',
7979
),

android_splash_screen/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class _MyHomePageState extends State<MyHomePage> {
5959
return Scaffold(
6060
body: Center(
6161
child: Column(
62-
children: <Widget>[
62+
children: [
6363
const Padding(
6464
padding: EdgeInsets.only(top: 42, bottom: 250),
6565
child: Align(

animations/lib/src/basics/08_fade_transition.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
5353
body: Center(
5454
child: Column(
5555
mainAxisSize: MainAxisSize.min,
56-
children: <Widget>[
56+
children: [
5757
FadeTransition(
5858
opacity: _animation,
5959
child: const Icon(

animations/lib/src/misc/animated_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
7878
return Scaffold(
7979
appBar: AppBar(
8080
title: const Text('AnimatedList'),
81-
actions: <Widget>[
81+
actions: [
8282
IconButton(
8383
icon: const Icon(Icons.add),
8484
onPressed: addUser,

animations/lib/src/misc/card_swipe.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
4242
padding: const EdgeInsets.all(12.0),
4343
child: Center(
4444
child: Column(
45-
children: <Widget>[
45+
children: [
4646
Expanded(
4747
child: ClipRect(
4848
child: Stack(
49-
children: <Widget>[
49+
children: [
5050
for (final fileName in fileNames)
5151
SwipeableCard(
5252
imageAssetName: fileName,

experimental/desktop_photo_search/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class UnsplashHomePage extends StatelessWidget {
115115
onPhotoSave: (photo) async {
116116
final path = await getSavePath(
117117
suggestedName: '${photo.id}.jpg',
118-
acceptedTypeGroups: <XTypeGroup>[
118+
acceptedTypeGroups: [
119119
XTypeGroup(
120120
label: 'JPG',
121121
extensions: ['jpg'],

experimental/desktop_photo_search/lib/src/widgets/about_dialog.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PolicyDialog extends StatelessWidget {
4242
text: TextSpan(
4343
text: '• ',
4444
style: const TextStyle(color: Colors.black, fontSize: 18),
45-
children: <TextSpan>[
45+
children: [
4646
TextSpan(
4747
text: 'https://policies.google.com/terms',
4848
style: const TextStyle(
@@ -64,7 +64,7 @@ class PolicyDialog extends StatelessWidget {
6464
text: TextSpan(
6565
text: '• ',
6666
style: const TextStyle(color: Colors.black, fontSize: 18),
67-
children: <TextSpan>[
67+
children: [
6868
TextSpan(
6969
text: 'https://unsplash.com/terms',
7070
style: const TextStyle(
@@ -86,7 +86,7 @@ class PolicyDialog extends StatelessWidget {
8686
);
8787
},
8888
),
89-
actions: <Widget>[
89+
actions: [
9090
TextButton(
9191
onPressed: () {
9292
Navigator.of(context).pop();

experimental/desktop_photo_search/lib/src/widgets/photo_search_dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class _PhotoSearchDialogState extends State<PhotoSearchDialog> {
4949
}
5050
},
5151
),
52-
actions: <Widget>[
52+
actions: [
5353
TextButton(
5454
onPressed: () {
5555
Navigator.of(context).pop();

experimental/web_dashboard/lib/src/widgets/dialogs.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class NewCategoryDialog extends StatelessWidget {
1717
Widget build(BuildContext context) {
1818
return const SimpleDialog(
1919
title: Text('New Category'),
20-
children: <Widget>[
20+
children: [
2121
NewCategoryForm(),
2222
],
2323
);

experimental/web_dashboard/lib/src/widgets/edit_entry.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class _NewEntryFormState extends State<NewEntryForm> {
2727

2828
return Column(
2929
crossAxisAlignment: CrossAxisAlignment.start,
30-
children: <Widget>[
30+
children: [
3131
Padding(
3232
padding: const EdgeInsets.all(8.0),
3333
child: CategoryDropdown(

form_app/lib/src/autofill.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
6565
hintText: '(123) 456-7890',
6666
labelText: 'Telephone',
6767
),
68-
autofillHints: <String>[AutofillHints.telephoneNumber],
68+
autofillHints: [AutofillHints.telephoneNumber],
6969
),
7070
const TextField(
7171
keyboardType: TextInputType.streetAddress,
@@ -74,7 +74,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
7474
hintText: '123 4th Ave',
7575
labelText: 'Street Address',
7676
),
77-
autofillHints: <String>[AutofillHints.streetAddressLine1],
77+
autofillHints: [AutofillHints.streetAddressLine1],
7878
),
7979
const TextField(
8080
keyboardType: TextInputType.number,
@@ -83,23 +83,23 @@ class _AutofillDemoState extends State<AutofillDemo> {
8383
hintText: '12345',
8484
labelText: 'Postal Code',
8585
),
86-
autofillHints: <String>[AutofillHints.postalCode],
86+
autofillHints: [AutofillHints.postalCode],
8787
),
8888
const TextField(
8989
textInputAction: TextInputAction.next,
9090
decoration: InputDecoration(
9191
hintText: 'United States',
9292
labelText: 'Country',
9393
),
94-
autofillHints: <String>[AutofillHints.countryName],
94+
autofillHints: [AutofillHints.countryName],
9595
),
9696
const TextField(
9797
keyboardType: TextInputType.number,
9898
decoration: InputDecoration(
9999
hintText: '1',
100100
labelText: 'Country Code',
101101
),
102-
autofillHints: <String>[AutofillHints.countryCode],
102+
autofillHints: [AutofillHints.countryCode],
103103
),
104104
].expand(
105105
(widget) => [

ios_app_clip/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class _DemoState extends State<Demo> {
4343
child: Center(
4444
child: Column(
4545
mainAxisAlignment: MainAxisAlignment.center,
46-
children: <Widget>[
46+
children: [
4747
Text(deviceInfo),
4848
const Padding(padding: EdgeInsets.only(top: 18)),
4949
const FlutterLogo(size: 128),

jsonexample/test/simple_object_unit_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:jsonexample/dart_convert/converted_simple_object.dart';
1111
import 'package:jsonexample/json_serializable/serializable_simple_object.dart';
1212

1313
void main() {
14-
const typicalObjectJson = <String, dynamic>{
14+
const typicalObjectJson = {
1515
'aString': 'Blah, blah, blah.',
1616
'anInt': 1,
1717
'aDouble': 1.0,
@@ -20,7 +20,7 @@ void main() {
2020
'aListOfDoubles': [1.0, 2.0, 3.0]
2121
};
2222

23-
const emptyListJson = <String, dynamic>{
23+
const emptyListJson = {
2424
'aString': 'Blah, blah, blah.',
2525
'anInt': 1,
2626
'aDouble': 1.0,
@@ -29,7 +29,7 @@ void main() {
2929
'aListOfDoubles': <double>[]
3030
};
3131

32-
const unexpectedPropertiesJson = <String, dynamic>{
32+
const unexpectedPropertiesJson = {
3333
'aString': 'Blah, blah, blah.',
3434
'anInt': 1,
3535
'aDouble': 1.0,

place_tracker/lib/stub_data.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class StubData {
145145
),
146146
];
147147

148-
static const reviewStrings = <String>[
148+
static const reviewStrings = [
149149
'My favorite place in Portland. The employees are wonderful and so is the food. I go here at least once a month!',
150150
'Staff was very friendly. Great atmosphere and good music. Would recommend.',
151151
'Best. Place. In. Town. Period.'

platform_channels/lib/src/add_pet_details.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class _AddPetDetailsState extends State<AddPetDetails> {
2525
return Scaffold(
2626
appBar: AppBar(
2727
title: const Text('Add Pet Details'),
28-
actions: <Widget>[
28+
actions: [
2929
IconButton(
3030
icon: const Icon(Icons.add),
3131
onPressed: () {

provider_counter/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class MyHomePage extends StatelessWidget {
6363
body: Center(
6464
child: Column(
6565
mainAxisAlignment: MainAxisAlignment.center,
66-
children: <Widget>[
66+
children: [
6767
const Text('You have pushed the button this many times:'),
6868
// Consumer looks for an ancestor Provider widget
6969
// and retrieves its model (Counter, in this case).

testing_app/lib/screens/home.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class HomePage extends StatelessWidget {
1717
return Scaffold(
1818
appBar: AppBar(
1919
title: const Text('Testing Sample'),
20-
actions: <Widget>[
20+
actions: [
2121
TextButton.icon(
2222
style: TextButton.styleFrom(primary: Colors.white),
2323
onPressed: () {

veggieseasons/lib/screens/details.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class InfoView extends StatelessWidget {
174174
children: [
175175
Row(
176176
mainAxisSize: MainAxisSize.max,
177-
children: <Widget>[
177+
children: [
178178
FutureBuilder<Set<VeggieCategory>>(
179179
future: prefs.preferredCategories,
180180
builder: (context, snapshot) {

veggieseasons/lib/screens/settings.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class SettingsScreen extends StatelessWidget {
233233
content: const Text(
234234
'Are you sure you want to reset the current settings?',
235235
),
236-
actions: <Widget>[
236+
actions: [
237237
CupertinoDialogAction(
238238
isDestructiveAction: true,
239239
child: const Text('Yes'),
@@ -266,15 +266,15 @@ class SettingsScreen extends StatelessWidget {
266266
Styles.scaffoldBackground(CupertinoTheme.brightnessOf(context)),
267267
child: CustomScrollView(
268268
restorationId: 'list',
269-
slivers: <Widget>[
269+
slivers: [
270270
const CupertinoSliverNavigationBar(
271271
largeTitle: Text('Settings'),
272272
),
273273
SliverSafeArea(
274274
top: false,
275275
sliver: SliverList(
276276
delegate: SliverChildListDelegate(
277-
<Widget>[
277+
[
278278
SettingsGroup(
279279
items: [
280280
_buildCaloriesItem(context, prefs),

veggieseasons/lib/widgets/settings_item.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class SettingsItemState extends State<SettingsItem> {
130130
child: widget.subtitle != null
131131
? Column(
132132
crossAxisAlignment: CrossAxisAlignment.start,
133-
children: <Widget>[
133+
children: [
134134
const SizedBox(height: 8.5),
135135
Text(widget.label,
136136
style: themeData.textTheme.textStyle),

veggieseasons/lib/widgets/veggie_card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class VeggieCard extends StatelessWidget {
122122
padding: const EdgeInsets.all(16),
123123
child: Column(
124124
crossAxisAlignment: CrossAxisAlignment.start,
125-
children: <Widget>[
125+
children: [
126126
Text(
127127
veggie.name,
128128
style: Styles.cardTitleText(themeData),

web/charts/lib/axes/line_disjoint_axis.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class DisjointMeasureAxisLineChart extends StatelessWidget {
153153
primaryMeasureAxis: const charts.NumericAxisSpec(
154154
tickProviderSpec: charts.StaticNumericTickProviderSpec(
155155
// Create the ticks to be used the domain axis.
156-
<charts.TickSpec<num>>[
156+
[
157157
charts.TickSpec(0, label: ''),
158158
charts.TickSpec(1, label: ''),
159159
charts.TickSpec(2, label: ''),

web/charts/lib/axes/statically_provided_ticks.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class StaticallyProvidedTicks extends StatelessWidget {
8181
@override
8282
Widget build(BuildContext context) {
8383
// Create the ticks to be used the domain axis.
84-
final staticTicks = <charts.TickSpec<String>>[
84+
final staticTicks = [
8585
const charts.TickSpec(
8686
// Value must match the domain value.
8787
'2014',

web/charts/lib/drawer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class GalleryDrawer extends StatelessWidget {
2929
@override
3030
Widget build(BuildContext context) {
3131
return Drawer(
32-
child: ListView(children: <Widget>[
32+
child: ListView(children: [
3333
// Performance overlay toggle.
3434
ListTile(
3535
leading: const Icon(Icons.assessment),

web/charts/lib/gallery_scaffold.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class _GalleryScaffoldState extends State<GalleryScaffold> {
5757
appBar: AppBar(title: Text(widget.title)),
5858
body: Padding(
5959
padding: const EdgeInsets.all(8.0),
60-
child: Column(children: <Widget>[
60+
child: Column(children: [
6161
SizedBox(height: 250.0, child: widget.childBuilder()),
6262
])),
6363
floatingActionButton: FloatingActionButton(

web/github_dataviz/lib/catmull.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class CatmullInterpolator implements Interpolator {
6060
}
6161

6262
static void test() {
63-
List<Point2D> controlPoints = <Point2D>[];
63+
final controlPoints = <Point2D>[];
6464
controlPoints.add(Point2D(-1, 1));
6565
controlPoints.add(Point2D(0, 1));
6666
controlPoints.add(Point2D(1, -1));

0 commit comments

Comments
 (0)