refactor: Switch to flutter_lints

This commit is contained in:
Krille Fear 2021-10-14 18:09:30 +02:00
commit 13fda9458f
101 changed files with 719 additions and 653 deletions

View file

@ -97,7 +97,9 @@ class BackgroundPush {
{final void Function(String errorMsg, {Uri link}) onFcmError}) {
final instance = BackgroundPush.clientOnly(_client);
instance.context = _context;
// ignore: prefer_initializing_formals
instance.router = router;
// ignore: prefer_initializing_formals
instance.onFcmError = onFcmError;
instance.fullInit();
return instance;
@ -301,7 +303,7 @@ class BackgroundPush {
}
// initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
final initializationSettingsAndroid =
const initializationSettingsAndroid =
AndroidInitializationSettings('notifications_icon');
final initializationSettingsIOS =
IOSInitializationSettings(onDidReceiveLocalNotification: (i, a, b, c) {
@ -596,11 +598,6 @@ class BackgroundPush {
// load the locale
await loadLocale();
// Count all unread events
var unreadEvents = 0;
client.rooms
.forEach((Room room) => unreadEvents += room.notificationCount ?? 0);
// Calculate title
final title = l10n.unreadMessages(room.notificationCount ?? 0);
@ -645,7 +642,7 @@ class BackgroundPush {
),
ticker: l10n.newMessageInFluffyChat,
);
final iOSPlatformChannelSpecifics = IOSNotificationDetails();
const iOSPlatformChannelSpecifics = IOSNotificationDetails();
final platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics,
iOS: iOSPlatformChannelSpecifics,
@ -681,7 +678,7 @@ class BackgroundPush {
// Display notification
final androidPlatformChannelSpecifics = _getAndroidNotificationDetails();
final iOSPlatformChannelSpecifics = IOSNotificationDetails();
const iOSPlatformChannelSpecifics = IOSNotificationDetails();
final platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics,
iOS: iOSPlatformChannelSpecifics,
@ -702,7 +699,7 @@ class BackgroundPush {
AndroidNotificationDetails _getAndroidNotificationDetails(
{MessagingStyleInformation styleInformation, String ticker}) {
final color = (context != null ? Theme.of(context).primaryColor : null) ??
Color(0xFF5625BA);
const Color(0xFF5625BA);
return AndroidNotificationDetails(
AppConfig.pushNotificationsChannelId,

View file

@ -22,7 +22,7 @@ extension DateTimeExtension on DateTime {
/// Two message events can belong to the same environment. That means that they
/// don't need to display the time they were sent because they are close
/// enaugh.
static final minutesBetweenEnvironments = 5;
static const minutesBetweenEnvironments = 5;
/// Checks if two DateTimes are close enough to belong to the same
/// environment.

View file

@ -31,7 +31,7 @@ class Store {
static final _mutex = AsyncMutex();
Store()
: secureStorage = PlatformInfos.isMobile ? FlutterSecureStorage() : null;
: secureStorage = PlatformInfos.isMobile ? const FlutterSecureStorage() : null;
Future<void> _setupLocalStorage() async {
if (storage == null) {

View file

@ -55,7 +55,7 @@ class FlutterMatrixHiveStore extends FamedlySdkHiveDatabase {
// Workaround for secure storage is calling Platform.operatingSystem on web
if (kIsWeb) throw MissingPluginException();
final secureStorage = const FlutterSecureStorage();
const secureStorage = FlutterSecureStorage();
final containsEncryptionKey =
await secureStorage.containsKey(key: _hiveCipherStorageKey);
if (!containsEncryptionKey) {

View file

@ -53,11 +53,11 @@ abstract class PlatformInfos {
),
OutlinedButton(
onPressed: () => launch(AppConfig.emojiFontUrl),
child: Text(AppConfig.emojiFontName),
child: const Text(AppConfig.emojiFontName),
),
OutlinedButton(
onPressed: () => VRouter.of(context).to('logs'),
child: Text('Logs'),
child: const Text('Logs'),
),
SentrySwitchListTile(label: L10n.of(context).sendBugReports),
],