Skip to content

Commit

Permalink
Use super parameters in templates (flutter#101157)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer authored Apr 14, 2022
1 parent cc4cc69 commit 329ceae
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions packages/flutter_tools/templates/app/lib/main.dart.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {

{{^withPluginHook}}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

// This widget is the root of your application.
@override
Expand All @@ -42,7 +42,7 @@ class MyApp extends StatelessWidget {
}

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

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

@override
State<MyApp> createState() => _MyAppState();
Expand Down Expand Up @@ -183,7 +183,7 @@ class _MyAppState extends State<MyApp> {
{{/withPlatformChannelPluginHook}}
{{#withFfiPluginHook}}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

@override
_MyAppState createState() => _MyAppState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() => runApp(const MyApp());

{{^withPlatformChannelPluginHook}}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

// This widget is the root of your application.
@override
Expand All @@ -34,7 +34,7 @@ class MyApp extends StatelessWidget {
}

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

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

@override
State<MyApp> createState() => _MyAppState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import 'settings/settings_view.dart';
/// The Widget that configures your application.
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
super.key,
required this.settingsController,
}) : super(key: key);
});

final SettingsController settingsController;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';

/// Displays detailed information about a SampleItem.
class SampleItemDetailsView extends StatelessWidget {
const SampleItemDetailsView({Key? key}) : super(key: key);
const SampleItemDetailsView({super.key});

static const routeName = '/sample_item';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import 'sample_item_details_view.dart';
/// Displays a list of SampleItems.
class SampleItemListView extends StatelessWidget {
const SampleItemListView({
Key? key,
super.key,
this.items = const [SampleItem(1), SampleItem(2), SampleItem(3)],
}) : super(key: key);
});

static const routeName = '/';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'settings_controller.dart';
/// When a user changes a setting, the SettingsController is updated and
/// Widgets that listen to the SettingsController are rebuilt.
class SettingsView extends StatelessWidget {
const SettingsView({Key? key, required this.controller}) : super(key: key);
const SettingsView({super.key, required this.controller});

static const routeName = '/settings';

Expand Down

0 comments on commit 329ceae

Please sign in to comment.