From 4069bfbe9e4e931105289a696f6dadded6b2822c Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Mon, 7 Jun 2021 14:18:38 +1000 Subject: [PATCH] Adjust experimental/federated_plugin/federated_plugin lint rules (#817) --- .../federated_plugin/analysis_options.yaml | 1 - .../example/analysis_option.yaml | 34 ++++++------------- .../federated_plugin/example/lib/main.dart | 8 +++-- .../example/test/widget_test.dart | 2 +- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/experimental/federated_plugin/federated_plugin/analysis_options.yaml b/experimental/federated_plugin/federated_plugin/analysis_options.yaml index 30ac27228..85f6fbe91 100644 --- a/experimental/federated_plugin/federated_plugin/analysis_options.yaml +++ b/experimental/federated_plugin/federated_plugin/analysis_options.yaml @@ -17,4 +17,3 @@ linter: test_types_in_equals: true throw_in_finally: true unnecessary_statements: true - use_key_in_widget_constructors: false diff --git a/experimental/federated_plugin/federated_plugin/example/analysis_option.yaml b/experimental/federated_plugin/federated_plugin/example/analysis_option.yaml index b1535cc60..85f6fbe91 100644 --- a/experimental/federated_plugin/federated_plugin/example/analysis_option.yaml +++ b/experimental/federated_plugin/federated_plugin/example/analysis_option.yaml @@ -1,4 +1,4 @@ -include: package:pedantic/analysis_options.1.11.0.yaml +include: package:flutter_lints/flutter.yaml analyzer: strong-mode: @@ -7,25 +7,13 @@ analyzer: linter: rules: - - avoid_types_on_closure_parameters - - avoid_void_async - - await_only_futures - - camel_case_types - - cancel_subscriptions - - close_sinks - - constant_identifier_names - - control_flow_in_finally - - directives_ordering - - empty_statements - - hash_and_equals - - implementation_imports - - non_constant_identifier_names - - package_api_docs - - package_names - - package_prefixed_library_names - - test_types_in_equals - - throw_in_finally - - unnecessary_brace_in_string_interps - - unnecessary_getters_setters - - unnecessary_new - - unnecessary_statements + avoid_types_on_closure_parameters: true + avoid_void_async: true + cancel_subscriptions: true + close_sinks: true + directives_ordering: true + package_api_docs: true + package_prefixed_library_names: true + test_types_in_equals: true + throw_in_finally: true + unnecessary_statements: true diff --git a/experimental/federated_plugin/federated_plugin/example/lib/main.dart b/experimental/federated_plugin/federated_plugin/example/lib/main.dart index 4cf60124e..79c2706aa 100644 --- a/experimental/federated_plugin/federated_plugin/example/lib/main.dart +++ b/experimental/federated_plugin/federated_plugin/example/lib/main.dart @@ -7,13 +7,15 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { - return MaterialApp( + return const MaterialApp( home: HomePage(), ); } @@ -22,6 +24,8 @@ class MyApp extends StatelessWidget { /// Demonstrates how to use the getBatteryLevel method from federated_plugin to retrieve /// current battery level of device. class HomePage extends StatefulWidget { + const HomePage({Key? key}) : super(key: key); + @override _HomePageState createState() => _HomePageState(); } diff --git a/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart b/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart index a22356062..f089561b5 100644 --- a/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart +++ b/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart @@ -19,7 +19,7 @@ void main() { }); testWidgets('get current battery level from platform', (tester) async { - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); // Tap button to retrieve current battery level from platform. await tester.tap(find.byType(ElevatedButton));