Update samples to use repo analysis options, Fix sample templates and a ton of analyzer issues (#77868)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
{{code-dartImports}}
|
||||
{{code-imports}}
|
||||
|
||||
{{code-main}}
|
||||
|
||||
@@ -2,20 +2,23 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetsApp(
|
||||
return const WidgetsApp(
|
||||
title: 'Flutter Code Sample',
|
||||
home: MyStatefulWidget(),
|
||||
color: const Color(0xffffffff),
|
||||
color: Color(0xffffffff),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +27,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoApp(
|
||||
return const CupertinoApp(
|
||||
title: _title,
|
||||
home: MyStatefulWidget(),
|
||||
);
|
||||
@@ -25,7 +28,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoApp(
|
||||
return const CupertinoApp(
|
||||
title: _title,
|
||||
home: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
||||
@@ -28,7 +31,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoApp(
|
||||
return const CupertinoApp(
|
||||
title: _title,
|
||||
home: MyStatefulWidget(),
|
||||
);
|
||||
@@ -25,7 +28,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
return const MaterialApp(
|
||||
title: _title,
|
||||
home: MyStatefulWidget(),
|
||||
);
|
||||
@@ -25,7 +28,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
return const MaterialApp(
|
||||
title: _title,
|
||||
home: MyStatefulWidget(),
|
||||
);
|
||||
@@ -25,7 +28,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetsApp(
|
||||
title: 'Flutter Code Sample',
|
||||
home: Center(
|
||||
home: const Center(
|
||||
child: MyStatefulWidget(restorationId: 'main'),
|
||||
),
|
||||
color: const Color(0xffffffff),
|
||||
@@ -26,7 +29,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key, this.restorationId}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key, this.restorationId}) : super(key: key);
|
||||
|
||||
final String? restorationId;
|
||||
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
@@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: MyStatefulWidget(),
|
||||
body: const MyStatefulWidget(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -28,7 +31,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
@@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: Center(
|
||||
body: const Center(
|
||||
child: MyStatefulWidget(),
|
||||
),
|
||||
),
|
||||
@@ -30,7 +33,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
@@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: Center(
|
||||
body: const Center(
|
||||
child: MyStatefulWidget(),
|
||||
),
|
||||
),
|
||||
@@ -30,7 +33,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,20 +2,23 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetsApp(
|
||||
return const WidgetsApp(
|
||||
title: 'Flutter Code Sample',
|
||||
home: MyStatefulWidget(),
|
||||
color: const Color(0xffffffff),
|
||||
color: Color(0xffffffff),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +27,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateful widget that the main application instantiates.
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
MyStatefulWidget({Key? key}) : super(key: key);
|
||||
const MyStatefulWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
|
||||
|
||||
@@ -2,21 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetsApp(
|
||||
title: 'Flutter Code Sample',
|
||||
builder: (BuildContext context, Widget navigator) {
|
||||
return MyStatelessWidget();
|
||||
},
|
||||
builder: (BuildContext context, Widget? navigator) => const MyStatelessWidget(),
|
||||
color: const Color(0xffffffff),
|
||||
);
|
||||
}
|
||||
@@ -26,7 +27,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoApp(
|
||||
return const CupertinoApp(
|
||||
title: _title,
|
||||
home: MyStatelessWidget(),
|
||||
);
|
||||
@@ -26,7 +29,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoApp(
|
||||
return const CupertinoApp(
|
||||
title: _title,
|
||||
home: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(middle: const Text(_title)),
|
||||
@@ -29,7 +32,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
return const MaterialApp(
|
||||
title: _title,
|
||||
home: MyStatelessWidget(),
|
||||
);
|
||||
@@ -26,7 +29,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
@@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: MyStatelessWidget(),
|
||||
body: const MyStatelessWidget(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -29,7 +32,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
|
||||
{{description}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-dartImports}}
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
{{code-imports}}
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
/// This is the main application widget.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
|
||||
@override
|
||||
@@ -18,7 +21,7 @@ class MyApp extends StatelessWidget {
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: Center(
|
||||
body: const Center(
|
||||
child: MyStatelessWidget(),
|
||||
),
|
||||
),
|
||||
@@ -31,7 +34,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
/// This is the stateless widget that the main application instantiates.
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
MyStatelessWidget({Key? key}) : super(key: key);
|
||||
const MyStatelessWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
{{code}}
|
||||
|
||||
Reference in New Issue
Block a user