refactor: Add more linter rules
This commit is contained in:
parent
1cd3a91037
commit
7a1eded1bb
5 changed files with 28 additions and 11 deletions
|
|
@ -28,3 +28,23 @@ dart_code_linter:
|
|||
- avoid-unnecessary-type-casts
|
||||
- avoid-unrelated-type-assertions
|
||||
- no-boolean-literal-compare
|
||||
- no-equal-then-else
|
||||
- prefer-first
|
||||
- prefer-last
|
||||
- prefer-immediate-return
|
||||
- prefer-enums-by-name
|
||||
- avoid-unnecessary-conditionals
|
||||
# TODO:
|
||||
# - member-ordering
|
||||
# - avoid-late-keyword
|
||||
# - avoid-non-null-assertion
|
||||
# - avoid-global-state
|
||||
# - prefer-match-file-name
|
||||
# - avoid-banned-imports:
|
||||
# entries:
|
||||
# - paths: ['some/folder/.*\.dart', 'another/folder/.*\.dart']
|
||||
# deny: ['package:flutter/material.dart']
|
||||
# message: 'Do not import Flutter Material Design library, we should not depend on it!'
|
||||
# - no-magic-number:
|
||||
# allowed: [-1, 0, 1,2,4,6,8,12,16,32,40,56,64]
|
||||
# allow-only-once: true
|
||||
|
|
@ -159,7 +159,7 @@ class InputBar extends StatelessWidget {
|
|||
slugify(
|
||||
user.displayName!.toLowerCase(),
|
||||
).contains(userSearch))) ||
|
||||
user.id.split(':')[0].toLowerCase().contains(userSearch)) {
|
||||
user.id.localpart!.toLowerCase().contains(userSearch)) {
|
||||
ret.add({
|
||||
'type': 'user',
|
||||
'mxid': user.id,
|
||||
|
|
@ -185,17 +185,14 @@ class InputBar extends StatelessWidget {
|
|||
((state.content['alias'] is String &&
|
||||
state.content
|
||||
.tryGet<String>('alias')!
|
||||
.split(':')[0]
|
||||
.localpart!
|
||||
.toLowerCase()
|
||||
.contains(roomSearch)) ||
|
||||
(state.content['alt_aliases'] is List &&
|
||||
(state.content['alt_aliases'] as List).any(
|
||||
(l) =>
|
||||
l is String &&
|
||||
l
|
||||
.split(':')[0]
|
||||
.toLowerCase()
|
||||
.contains(roomSearch),
|
||||
l.localpart!.toLowerCase().contains(roomSearch),
|
||||
)))) ||
|
||||
(r.name.toLowerCase().contains(roomSearch))) {
|
||||
ret.add({
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class MyCallingPage extends State<Calling> {
|
|||
|
||||
MediaStream? get remoteStream {
|
||||
if (call.getRemoteStreams.isNotEmpty) {
|
||||
return call.getRemoteStreams[0].stream!;
|
||||
return call.getRemoteStreams.first.stream!;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ class MyCallingPage extends State<Calling> {
|
|||
void _switchCamera() async {
|
||||
if (call.localUserMediaStream != null) {
|
||||
await Helper.switchCamera(
|
||||
call.localUserMediaStream!.stream!.getVideoTracks()[0],
|
||||
call.localUserMediaStream!.stream!.getVideoTracks().first,
|
||||
);
|
||||
}
|
||||
setState(() {});
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
} else {
|
||||
title = Text(L10n.of(context).compareNumbersMatch);
|
||||
final numbers = widget.request.sasNumbers;
|
||||
final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}';
|
||||
final numbstr = '${numbers.first}-${numbers[1]}-${numbers[2]}';
|
||||
compareWidget = TextSpan(
|
||||
text: numbstr,
|
||||
style: const TextStyle(fontSize: 40),
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ class FluffyChatPushPayload {
|
|||
if (parts.length != 3) {
|
||||
return FluffyChatPushPayload(null, null, null);
|
||||
}
|
||||
return FluffyChatPushPayload(parts[0], parts[1], parts[2]);
|
||||
return FluffyChatPushPayload(parts.first, parts[1], parts[2]);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue