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
+12 -35
View File
@@ -10,21 +10,12 @@ import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class TrackType extends $pb.ProtobufEnum {
static const TrackType AUDIO = TrackType._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'AUDIO');
static const TrackType VIDEO = TrackType._(
1,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'VIDEO');
static const TrackType DATA = TrackType._(
2,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'DATA');
static const TrackType AUDIO =
TrackType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AUDIO');
static const TrackType VIDEO =
TrackType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'VIDEO');
static const TrackType DATA =
TrackType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DATA');
static const $core.List<TrackType> values = <TrackType>[
AUDIO,
@@ -32,8 +23,7 @@ class TrackType extends $pb.ProtobufEnum {
DATA,
];
static final $core.Map<$core.int, TrackType> _byValue =
$pb.ProtobufEnum.initByValue(values);
static final $core.Map<$core.int, TrackType> _byValue = $pb.ProtobufEnum.initByValue(values);
static TrackType? valueOf($core.int value) => _byValue[value];
const TrackType._($core.int v, $core.String n) : super(v, n);
@@ -41,28 +31,15 @@ class TrackType extends $pb.ProtobufEnum {
class ParticipantInfo_State extends $pb.ProtobufEnum {
static const ParticipantInfo_State JOINING = ParticipantInfo_State._(
0,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'JOINING');
0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'JOINING');
static const ParticipantInfo_State JOINED = ParticipantInfo_State._(
1,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'JOINED');
1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'JOINED');
static const ParticipantInfo_State ACTIVE = ParticipantInfo_State._(
2,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'ACTIVE');
2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ACTIVE');
static const ParticipantInfo_State DISCONNECTED = ParticipantInfo_State._(
3,
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
? ''
: 'DISCONNECTED');
3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DISCONNECTED');
static const $core.List<ParticipantInfo_State> values =
<ParticipantInfo_State>[
static const $core.List<ParticipantInfo_State> values = <ParticipantInfo_State>[
JOINING,
JOINED,
ACTIVE,