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 - prefer_final_in_for_each
- sort_pub_dependencies - sort_pub_dependencies
- require_trailing_commas - require_trailing_commas
- omit_local_variable_types
analyzer: analyzer:
errors: errors:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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