1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Upgrading samples to flutter_lints, part 1 of n (#804)

This commit is contained in:
Brett Morgan
2021-06-05 12:24:28 +10:00
committed by GitHub
parent 14921d0c06
commit 936d1fdaae
230 changed files with 2361 additions and 2444 deletions

View File

@@ -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,14 @@ 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
use_key_in_widget_constructors: false

View File

@@ -33,19 +33,19 @@ class _HomePageState extends State<HomePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Federated Plugin Demo'),
title: const Text('Federated Plugin Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
batteryLevel == null
? SizedBox.shrink()
? const SizedBox.shrink()
: Text(
'Battery Level: $batteryLevel',
style: Theme.of(context).textTheme.headline5,
),
SizedBox(height: 16),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () async {
try {
@@ -64,7 +64,7 @@ class _HomePageState extends State<HomePage> {
);
}
},
child: Text('Get Battery Level'),
child: const Text('Get Battery Level'),
),
],
),

View File

@@ -97,6 +97,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -114,6 +121,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
@@ -135,13 +149,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface:
dependency: transitive
description:

View File

@@ -1,7 +1,7 @@
name: federated_plugin_example
description: Demonstrates how to use the federated_plugin plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment:
sdk: ">=2.12.0 <3.0.0"
@@ -17,7 +17,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.11.0
flutter_lints: ^1.0.0
flutter:
uses-material-design: true

View File

@@ -9,9 +9,9 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
group('federated plugin demo tests', () {
final batteryLevel = 45;
const batteryLevel = 45;
setUpAll(() {
MethodChannel('battery').setMockMethodCallHandler((call) async {
const MethodChannel('battery').setMockMethodCallHandler((call) async {
if (call.method == 'getBatteryLevel') {
return batteryLevel;
}

View File

@@ -83,6 +83,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -100,6 +107,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
@@ -121,13 +135,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface:
dependency: transitive
description:

View File

@@ -1,9 +1,8 @@
name: federated_plugin
description: A new flutter plugin project to demonstrate how to implement federated plugin.
version: 0.0.1
homepage:
publish_to: 'none'
publish_to: "none"
environment:
sdk: ">=2.12.0 <3.0.0"
@@ -24,7 +23,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.11.0
flutter_lints: ^1.0.0
flutter:
plugin:

View File

@@ -10,8 +10,8 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('Federated Plugin Test', () {
final batteryLevel = 34;
MethodChannel('battery').setMockMethodCallHandler((call) async {
const batteryLevel = 34;
const MethodChannel('battery').setMockMethodCallHandler((call) async {
if (call.method == 'getBatteryLevel') {
return batteryLevel;
}

View File

@@ -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,14 @@ 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
use_key_in_widget_constructors: false

View File

@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
@@ -55,11 +55,25 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
@@ -81,13 +95,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface:
dependency: "direct main"
description:
@@ -141,7 +148,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:

View File

@@ -17,4 +17,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.11.0
flutter_lints: ^1.0.0

View File

@@ -10,8 +10,8 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('MethodChannel test', () {
final batteryLevel = 89;
MethodChannel('battery').setMockMethodCallHandler((call) async {
const batteryLevel = 89;
const MethodChannel('battery').setMockMethodCallHandler((call) async {
if (call.method == 'getBatteryLevel') {
return batteryLevel;
}

View File

@@ -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,14 @@ 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
use_key_in_widget_constructors: false

View File

@@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "18.0.0"
version: "22.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.7.1"
archive:
dependency: transitive
description:
@@ -28,14 +28,14 @@ packages:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.1"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
@@ -49,7 +49,7 @@ packages:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
built_collection:
dependency: transitive
description:
@@ -63,7 +63,7 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.3"
version: "8.0.6"
characters:
dependency: transitive
description:
@@ -98,7 +98,7 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
version: "4.0.0"
collection:
dependency: transitive
description:
@@ -119,14 +119,14 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.14"
version: "2.0.1"
fake_async:
dependency: transitive
description:
@@ -165,6 +165,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -186,7 +193,7 @@ packages:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.1"
integration_test:
dependency: "direct dev"
description: flutter
@@ -199,13 +206,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
matcher:
dependency: transitive
description:
@@ -226,7 +240,7 @@ packages:
name: mockito
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.2"
version: "5.0.9"
package_config:
dependency: transitive
description:
@@ -242,7 +256,7 @@ packages:
source: hosted
version: "1.8.0"
pedantic:
dependency: "direct dev"
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
@@ -268,7 +282,7 @@ packages:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "4.2.1"
pub_semver:
dependency: transitive
description:
@@ -287,7 +301,7 @@ packages:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.10+4"
version: "1.0.1"
source_span:
dependency: transitive
description:
@@ -336,7 +350,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:
@@ -357,7 +371,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0+1"
version: "6.2.0"
watcher:
dependency: transitive
description:

View File

@@ -1,7 +1,6 @@
name: federated_plugin_web
description: Web implementation of federated_plugin to retrieve current battery level.
version: 0.0.1
homepage:
publish_to: none
environment:
@@ -21,7 +20,7 @@ dev_dependencies:
sdk: flutter
integration_test:
sdk: flutter
pedantic: ^1.11.0
flutter_lints: ^1.0.0
mockito: ^5.0.2
flutter: