Apply Flutter best practices [Non-Breaking] (#2)

* Add flutter_lints package

* Use key in widget constructors

lint: use_key_in_widget_constructors

* Unnecessary new keyword

lint: unnecessary_new

* Prefer const with constant constructors

* Exclude protobuf files from analyzer

* Private field could be final

* Annotate overridden members

* Use initializing formals when possible

* Don't access members with `this` unless avoiding shadowing

* Prefer is! operator

* Use isEmpty instead of length

* Use collection literals when possible

* Revert comment changes

* Cleaner null testing

* Misc fixes

* Avoid using `forEach` with a function literal

* Prefer `final` over `var` where applicable

* Enforce stricter type-checking

* Ignore VS Code files

* Flutter format

* Prefer using lowerCamelCase for constant names

* flutter format -l 100

* Disable `avoid_print` for examples

* Slight improvements to example

Should solve lint error: no_logic_in_create_state
This commit is contained in:
Hiroshi Horie
2021-08-31 16:35:07 +09:00
committed by GitHub
parent 4a75d78ef9
commit ab31ddabb9
41 changed files with 904 additions and 1228 deletions
+21 -7
View File
@@ -90,6 +90,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.4"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -116,6 +123,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
livekit_client:
dependency: "direct main"
description:
@@ -171,14 +185,14 @@ packages:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
path_provider_platform_interface:
dependency: transitive
description:
@@ -192,7 +206,7 @@ packages:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
pedantic:
dependency: transitive
description:
@@ -206,7 +220,7 @@ packages:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.2"
plugin_platform_interface:
dependency: transitive
description:
@@ -220,7 +234,7 @@ packages:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.1"
version: "4.2.3"
protobuf:
dependency: transitive
description:
@@ -330,7 +344,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.5"
version: "2.2.7"
xdg_directories:
dependency: transitive
description:
@@ -340,4 +354,4 @@ packages:
version: "0.2.0"
sdks:
dart: ">=2.13.0 <3.0.0"
flutter: ">=1.22.0"
flutter: ">=2.0.0"