refactor: Omit local types

This commit is contained in:
Krille 2024-07-04 15:42:00 +02:00
parent e88afdd357
commit ef5ea57c58
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
7 changed files with 10 additions and 9 deletions

View file

@ -9,6 +9,7 @@ linter:
- prefer_final_in_for_each
- sort_pub_dependencies
- require_trailing_commas
- omit_local_variable_types
analyzer:
errors:

View file

@ -14,7 +14,7 @@ class ChatEmojiPicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final theme = Theme.of(context);
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,

View file

@ -28,8 +28,8 @@ class EventInfoDialog extends StatelessWidget {
});
String get prettyJson {
const JsonDecoder decoder = JsonDecoder();
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
const decoder = JsonDecoder();
const encoder = JsonEncoder.withIndent(' ');
final object = decoder.convert(jsonEncode(event.toJson()));
return encoder.convert(object);
}

View file

@ -55,7 +55,7 @@ class InputBar extends StatelessWidget {
}
final searchText =
controller!.text.substring(0, controller!.selection.baseOffset);
final List<Map<String, String?>> ret = <Map<String, String?>>[];
final ret = <Map<String, String?>>[];
const maxResults = 30;
final commandMatch = RegExp(r'^/(\w*)$').firstMatch(searchText);

View file

@ -64,7 +64,7 @@ class SendFileDialogState extends State<SendFileDialog> {
@override
Widget build(BuildContext context) {
var sendStr = L10n.of(context)!.sendFile;
final bool allFilesAreImages =
final allFilesAreImages =
widget.files.every((file) => file is MatrixImageFile);
final sizeString = widget.files
.fold<double>(0, (p, file) => p + file.bytes.length)

View file

@ -165,7 +165,7 @@ class ClientChooserButton extends StatelessWidget {
Widget build(BuildContext context) {
final matrix = Matrix.of(context);
int clientCount = 0;
var clientCount = 0;
matrix.accountBundles.forEach((key, value) => clientCount += value.length);
return FutureBuilder<Profile>(
future: matrix.client.fetchOwnProfile(),
@ -292,7 +292,7 @@ class ClientChooserButton extends StatelessWidget {
);
// beginning from end if negative
if (index < 0) {
int clientCount = 0;
var clientCount = 0;
matrix.accountBundles
.forEach((key, value) => clientCount += value.length);
_handleKeyboardShortcut(matrix, clientCount, context);
@ -312,7 +312,7 @@ class ClientChooserButton extends StatelessWidget {
}
int? _shortcutIndexOfClient(MatrixState matrix, Client client) {
int index = 0;
var index = 0;
final bundles = matrix.accountBundles.keys.toList()
..sort(

View file

@ -82,7 +82,7 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
}
static Future<String> findDatabasePath(Client client) async {
String path = client.clientName;
var path = client.clientName;
if (!kIsWeb) {
Directory directory;
try {