Skip to content

Commit

Permalink
style: fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed Jan 6, 2024
1 parent cf40854 commit 62c1482
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
20 changes: 10 additions & 10 deletions lib/common/services/local_preferences_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class LocalPreferencesService implements ILocalPreferencesService {
Future<T?> read<T>({required String key}) async {
if (!_sharedPreferences.containsKey(key)) return null;
switch (T) {
case String:
case const (String):
return (_sharedPreferences.getString(key) ?? '') as T;
case int:
case const (int):
return _sharedPreferences.getInt(key) as T?;
case bool:
case const (bool):
return _sharedPreferences.getBool(key) as T?;
case double:
case const (double):
return _sharedPreferences.getDouble(key) as T?;
case List:
case List _:
return _sharedPreferences.getStringList(key) as T?;
default:
return _sharedPreferences.get(key) as T?;
Expand All @@ -31,19 +31,19 @@ class LocalPreferencesService implements ILocalPreferencesService {
@override
Future<bool> write<T>({required String key, required T value}) async {
switch (T) {
case String:
case const (String):
value as String;
return _sharedPreferences.setString(key, value);
case int:
case const (int):
value as int;
return _sharedPreferences.setInt(key, value);
case bool:
case const (bool):
value as bool;
return _sharedPreferences.setBool(key, value);
case double:
case const (double):
value as double;
return _sharedPreferences.setDouble(key, value);
case List:
case List _:
value as List<String>;
return _sharedPreferences.setStringList(key, value);
default:
Expand Down
4 changes: 0 additions & 4 deletions lib/ui/shared/custom_icons.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// ignore_for_file: member-ordering
/// Flutter icons Unicons
/// Copyright (C) 2020 by original authors @ fluttericon.com, fontello.com
/// This font was generated by FlutterIcon.com, which is derived from Fontello.
import 'package:flutter/widgets.dart';

class CustomIcons {
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/widgets/error_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class ErrorMessage extends StatelessWidget {
return (error as Error).getMessage();
}
switch (error.runtimeType) {
case ApiError:
case ApiError _:
return (error as ApiError).code.getMessage();
case DatabaseError:
case DatabaseError _:
return (error as DatabaseError).code.getMessage();
case AppError:
case AppError _:
return (error as AppError).code.getMessage();
default:
return '';
Expand Down

0 comments on commit 62c1482

Please sign in to comment.