enable lints prefer_const_declarations and prefer_const_literals_to_create_immutables (#14848)
This commit is contained in:
committed by
Ian Hickson
parent
7fab7f6d02
commit
3961306bad
@@ -109,8 +109,8 @@ linter:
|
||||
- prefer_conditional_assignment
|
||||
- prefer_const_constructors
|
||||
- prefer_const_constructors_in_immutables
|
||||
# - prefer_const_declarations # not yet tested
|
||||
# - prefer_const_literals_to_create_immutables # not yet tested
|
||||
- prefer_const_declarations
|
||||
- prefer_const_literals_to_create_immutables
|
||||
# - prefer_constructors_over_static_methods # not yet tested
|
||||
- prefer_contains
|
||||
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
|
||||
|
||||
@@ -102,8 +102,8 @@ linter:
|
||||
- prefer_conditional_assignment
|
||||
- prefer_const_constructors
|
||||
- prefer_const_constructors_in_immutables
|
||||
# - prefer_const_declarations # not yet tested
|
||||
# - prefer_const_literals_to_create_immutables # not yet tested
|
||||
- prefer_const_declarations
|
||||
- prefer_const_literals_to_create_immutables
|
||||
# - prefer_constructors_over_static_methods # not yet tested
|
||||
- prefer_contains
|
||||
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
|
||||
|
||||
@@ -116,7 +116,7 @@ void main() {
|
||||
child: new CupertinoAlertDialog(
|
||||
title: const Text('The Title'),
|
||||
content: new Text('Very long content ' * 20),
|
||||
actions: <Widget>[
|
||||
actions: const <Widget>[
|
||||
const CupertinoDialogAction(
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
Widget buildSliverAppBarApp({ bool floating, bool pinned, double expandedHeight, bool snap: false }) {
|
||||
return new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -241,7 +241,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
@@ -256,7 +256,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
@@ -428,7 +428,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
@@ -468,7 +468,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -236,7 +236,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -65,7 +65,7 @@ class _TestAppState extends State<TestApp> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -160,7 +160,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -442,7 +442,7 @@ class _TestAppState extends State<TestApp> {
|
||||
Widget build(BuildContext context) {
|
||||
return new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -363,7 +363,7 @@ void main() {
|
||||
child: const Text('body'),
|
||||
),
|
||||
),
|
||||
persistentFooterButtons: <Widget>[const Placeholder()],
|
||||
persistentFooterButtons: const <Widget>[const Placeholder()],
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1056,7 +1056,7 @@ class GeometryListenerState extends State<GeometryListener> {
|
||||
|
||||
if (geometryListenable != null)
|
||||
geometryListenable.removeListener(onGeometryChanged);
|
||||
|
||||
|
||||
geometryListenable = newListenable;
|
||||
geometryListenable.addListener(onGeometryChanged);
|
||||
cache = new GeometryCachePainter(geometryListenable);
|
||||
|
||||
@@ -360,7 +360,7 @@ void main() {
|
||||
),
|
||||
child: new Scaffold(
|
||||
bottomNavigationBar: new BottomNavigationBar(
|
||||
items: <BottomNavigationBarItem>[
|
||||
items: const <BottomNavigationBarItem>[
|
||||
const BottomNavigationBarItem(icon: const Icon(Icons.favorite), title: const Text('Animutation')),
|
||||
const BottomNavigationBarItem(icon: const Icon(Icons.block), title: const Text('Zombo.com')),
|
||||
],
|
||||
|
||||
@@ -17,7 +17,7 @@ import '../widgets/semantics_tester.dart';
|
||||
Widget boilerplate({ Widget child, TextDirection textDirection: TextDirection.ltr }) {
|
||||
return new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
],
|
||||
@@ -1661,7 +1661,7 @@ void main() {
|
||||
alignment: Alignment.topLeft,
|
||||
child: new TabBar(
|
||||
controller: controller,
|
||||
tabs: <Tab>[
|
||||
tabs: const <Tab>[
|
||||
const Tab(text: 'LEFT'),
|
||||
const Tab(text: 'RIGHT'),
|
||||
],
|
||||
|
||||
@@ -229,7 +229,7 @@ void _tests() {
|
||||
await tester.pumpWidget(
|
||||
new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -25,7 +25,7 @@ class _CustomPhysics extends ClampingScrollPhysics {
|
||||
Widget buildTest({ ScrollController controller, String title:'TTTTTTTT' }) {
|
||||
return new Localizations(
|
||||
locale: const Locale('en', 'US'),
|
||||
delegates: <LocalizationsDelegate<dynamic>>[
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
],
|
||||
|
||||
@@ -253,7 +253,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
new Stack(
|
||||
textDirection: TextDirection.ltr,
|
||||
children: <Widget>[
|
||||
children: const <Widget>[
|
||||
const Positioned(
|
||||
top: 5.0,
|
||||
bottom: 8.0,
|
||||
@@ -275,7 +275,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
new Container(
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
children: const <Widget>[
|
||||
const Positioned(
|
||||
top: 6.0,
|
||||
left: 7.0,
|
||||
|
||||
@@ -913,7 +913,7 @@ void main() {
|
||||
const Text('Label 1'),
|
||||
const Text('Label 2'),
|
||||
new Row(
|
||||
children: <Widget>[
|
||||
children: const <Widget>[
|
||||
const Text('Label 3'),
|
||||
const Text('Label 4'),
|
||||
const Text('Label 5'),
|
||||
@@ -976,7 +976,7 @@ void main() {
|
||||
new Transform.rotate(
|
||||
angle: pi / 2.0,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
children: const <Widget>[
|
||||
const Text('Label 3'),
|
||||
const Text('Label 4'),
|
||||
const Text('Label 5'),
|
||||
|
||||
@@ -15,7 +15,7 @@ void main() {
|
||||
data: const MediaQueryData(),
|
||||
child: new CustomScrollView(
|
||||
controller: controller,
|
||||
slivers: <Widget>[
|
||||
slivers: const <Widget>[
|
||||
const SliverAppBar(floating: true, pinned: true, expandedHeight: 200.0, title: const Text('A')),
|
||||
const SliverAppBar(primary: false, pinned: true, title: const Text('B')),
|
||||
const SliverList(
|
||||
|
||||
@@ -14,7 +14,7 @@ Future<Null> test(WidgetTester tester, double offset) {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Viewport(
|
||||
offset: new ViewportOffset.fixed(offset),
|
||||
slivers: <Widget>[
|
||||
slivers: const <Widget>[
|
||||
const SliverList(
|
||||
delegate: const SliverChildListDelegate(const <Widget>[
|
||||
const SizedBox(height: 400.0, child: const Text('a')),
|
||||
@@ -150,7 +150,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Viewport(
|
||||
offset: offset,
|
||||
slivers: <Widget>[
|
||||
slivers: const <Widget>[
|
||||
const SliverList(
|
||||
delegate: const SliverChildListDelegate(const <Widget>[
|
||||
const SizedBox(height: 251.0, child: const Text('a')),
|
||||
@@ -261,7 +261,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Viewport(
|
||||
offset: new ViewportOffset.zero(),
|
||||
slivers: <Widget>[
|
||||
slivers: const <Widget>[
|
||||
const SliverList(
|
||||
delegate: const SliverChildListDelegate(const <Widget>[
|
||||
const SizedBox(height: 400.0, child: const Text('a')),
|
||||
@@ -279,7 +279,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Viewport(
|
||||
offset: new ViewportOffset.fixed(100.0),
|
||||
slivers: <Widget>[
|
||||
slivers: const <Widget>[
|
||||
const SliverList(
|
||||
delegate: const SliverChildListDelegate(const <Widget>[
|
||||
const SizedBox(height: 400.0, child: const Text('a')),
|
||||
@@ -297,7 +297,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Viewport(
|
||||
offset: new ViewportOffset.fixed(100.0),
|
||||
slivers: <Widget>[
|
||||
slivers: const <Widget>[
|
||||
const SliverList(
|
||||
delegate: const SliverChildListDelegate(const <Widget>[
|
||||
const SizedBox(height: 4000.0, child: const Text('a')),
|
||||
@@ -315,7 +315,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Viewport(
|
||||
offset: new ViewportOffset.zero(),
|
||||
slivers: <Widget>[
|
||||
slivers: const <Widget>[
|
||||
const SliverList(
|
||||
delegate: const SliverChildListDelegate(const <Widget>[
|
||||
const SizedBox(height: 4000.0, child: const Text('a')),
|
||||
|
||||
@@ -31,7 +31,7 @@ void main() {
|
||||
await tester.pumpWidget(new MaterialApp(
|
||||
supportedLocales: <Locale>[locale],
|
||||
locale: locale,
|
||||
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
|
||||
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
],
|
||||
home: new Builder(builder: (BuildContext context) {
|
||||
@@ -85,7 +85,7 @@ void main() {
|
||||
await tester.pumpWidget(new MaterialApp(
|
||||
supportedLocales: <Locale>[locale],
|
||||
locale: locale,
|
||||
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
|
||||
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
],
|
||||
home: new Builder(builder: (BuildContext context) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'context.dart';
|
||||
import 'file_system.dart';
|
||||
import 'platform.dart';
|
||||
|
||||
final BotDetector _kBotDetector = const BotDetector();
|
||||
const BotDetector _kBotDetector = const BotDetector();
|
||||
|
||||
class BotDetector {
|
||||
const BotDetector();
|
||||
|
||||
Reference in New Issue
Block a user