Skip to content

Commit 329ceae

Browse files
authored
Use super parameters in templates (flutter#101157)
1 parent cc4cc69 commit 329ceae

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

packages/flutter_tools/templates/app/lib/main.dart.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void main() {
1717

1818
{{^withPluginHook}}
1919
class MyApp extends StatelessWidget {
20-
const MyApp({Key? key}) : super(key: key);
20+
const MyApp({super.key});
2121

2222
// This widget is the root of your application.
2323
@override
@@ -42,7 +42,7 @@ class MyApp extends StatelessWidget {
4242
}
4343

4444
class MyHomePage extends StatefulWidget {
45-
const MyHomePage({Key? key, required this.title}) : super(key: key);
45+
const MyHomePage({super.key, required this.title});
4646

4747
// This widget is the home page of your application. It is stateful, meaning
4848
// that it has a State object (defined below) that contains fields that affect
@@ -128,7 +128,7 @@ class _MyHomePageState extends State<MyHomePage> {
128128
{{/withPluginHook}}
129129
{{#withPlatformChannelPluginHook}}
130130
class MyApp extends StatefulWidget {
131-
const MyApp({Key? key}) : super(key: key);
131+
const MyApp({super.key});
132132

133133
@override
134134
State<MyApp> createState() => _MyAppState();
@@ -183,7 +183,7 @@ class _MyAppState extends State<MyApp> {
183183
{{/withPlatformChannelPluginHook}}
184184
{{#withFfiPluginHook}}
185185
class MyApp extends StatefulWidget {
186-
const MyApp({Key? key}) : super(key: key);
186+
const MyApp({super.key});
187187

188188
@override
189189
_MyAppState createState() => _MyAppState();

packages/flutter_tools/templates/module/common/lib/main.dart.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void main() => runApp(const MyApp());
1010

1111
{{^withPlatformChannelPluginHook}}
1212
class MyApp extends StatelessWidget {
13-
const MyApp({Key? key}) : super(key: key);
13+
const MyApp({super.key});
1414

1515
// This widget is the root of your application.
1616
@override
@@ -34,7 +34,7 @@ class MyApp extends StatelessWidget {
3434
}
3535

3636
class MyHomePage extends StatefulWidget {
37-
const MyHomePage({Key? key, required this.title}) : super(key: key);
37+
const MyHomePage({super.key, required this.title});
3838

3939
// This widget is the home page of your application. It is stateful, meaning
4040
// that it has a State object (defined below) that contains fields that affect
@@ -120,7 +120,7 @@ class _MyHomePageState extends State<MyHomePage> {
120120
{{/withPlatformChannelPluginHook}}
121121
{{#withPlatformChannelPluginHook}}
122122
class MyApp extends StatefulWidget {
123-
const MyApp({Key? key}) : super(key: key);
123+
const MyApp({super.key});
124124

125125
@override
126126
State<MyApp> createState() => _MyAppState();

packages/flutter_tools/templates/skeleton/lib/src/app.dart.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import 'settings/settings_view.dart';
1010
/// The Widget that configures your application.
1111
class MyApp extends StatelessWidget {
1212
const MyApp({
13-
Key? key,
13+
super.key,
1414
required this.settingsController,
15-
}) : super(key: key);
15+
});
1616

1717
final SettingsController settingsController;
1818

packages/flutter_tools/templates/skeleton/lib/src/sample_feature/sample_item_details_view.dart.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
22

33
/// Displays detailed information about a SampleItem.
44
class SampleItemDetailsView extends StatelessWidget {
5-
const SampleItemDetailsView({Key? key}) : super(key: key);
5+
const SampleItemDetailsView({super.key});
66

77
static const routeName = '/sample_item';
88

packages/flutter_tools/templates/skeleton/lib/src/sample_feature/sample_item_list_view.dart.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import 'sample_item_details_view.dart';
77
/// Displays a list of SampleItems.
88
class SampleItemListView extends StatelessWidget {
99
const SampleItemListView({
10-
Key? key,
10+
super.key,
1111
this.items = const [SampleItem(1), SampleItem(2), SampleItem(3)],
12-
}) : super(key: key);
12+
});
1313

1414
static const routeName = '/';
1515

packages/flutter_tools/templates/skeleton/lib/src/settings/settings_view.dart.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'settings_controller.dart';
77
/// When a user changes a setting, the SettingsController is updated and
88
/// Widgets that listen to the SettingsController are rebuilt.
99
class SettingsView extends StatelessWidget {
10-
const SettingsView({Key? key, required this.controller}) : super(key: key);
10+
const SettingsView({super.key, required this.controller});
1111

1212
static const routeName = '/settings';
1313

0 commit comments

Comments
 (0)