From 9e6d3761fed2990d8370cf6102ef3ec704e497a5 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 11 Mar 2022 17:16:46 +0100 Subject: [PATCH] Finish to fix notices --- lib/generated_plugin_registrant.dart | 3 ++- lib/models/custom_emoji.dart | 7 +------ lib/models/forez_presence.dart | 13 +++---------- lib/models/friend.dart | 10 ++-------- lib/models/new_conversation_message.dart | 3 +-- lib/ui/dialogs/multi_choices_dialog.dart | 4 +--- lib/ui/widgets/user_writing_in_conv_notifier.dart | 3 +-- lib/utils/files_utils.dart | 2 -- 8 files changed, 11 insertions(+), 34 deletions(-) diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index 3f7a053..e92aad5 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -9,7 +9,6 @@ import 'package:connectivity_plus_web/connectivity_plus_web.dart'; import 'package:file_picker/_internal/file_picker_web.dart'; import 'package:firebase_core_web/firebase_core_web.dart'; import 'package:firebase_messaging_web/firebase_messaging_web.dart'; -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:image_picker_for_web/image_picker_for_web.dart'; import 'package:package_info_plus_web/package_info_plus_web.dart'; import 'package:shared_preferences_web/shared_preferences_web.dart'; @@ -17,6 +16,8 @@ import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:video_player_web/video_player_web.dart'; import 'package:wakelock_web/wakelock_web.dart'; +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + // ignore: public_member_api_docs void registerPlugins(Registrar registrar) { ConnectivityPlusPlugin.registerWith(registrar); diff --git a/lib/models/custom_emoji.dart b/lib/models/custom_emoji.dart index 85211d5..5c53e78 100644 --- a/lib/models/custom_emoji.dart +++ b/lib/models/custom_emoji.dart @@ -1,5 +1,3 @@ - - /// Single custom emoji information /// /// @author Pierre Hubert @@ -15,10 +13,7 @@ class CustomEmoji { required int this.userID, required String this.shortcut, required String this.url, - }) : assert(id != null), - assert(userID != null), - assert(shortcut != null), - assert(url != null); + }); Map toMap() => { "id": id, diff --git a/lib/models/forez_presence.dart b/lib/models/forez_presence.dart index b307ec0..4ac121e 100644 --- a/lib/models/forez_presence.dart +++ b/lib/models/forez_presence.dart @@ -1,5 +1,3 @@ - - /// Single presence information /// /// @author Pierre Hubert @@ -15,15 +13,10 @@ class Presence { required this.year, required this.month, required this.day, - }) : assert(userID != null), - assert(year != null), - assert(month != null), - assert(day != null); + }); Presence.fromDateTime(DateTime dt, this.userID) - : assert(dt != null), - year = dt.year, + : year = dt.year, month = dt.month, - day = dt.day, - assert(userID != null); + day = dt.day; } diff --git a/lib/models/friend.dart b/lib/models/friend.dart index 09310d3..1ce628f 100644 --- a/lib/models/friend.dart +++ b/lib/models/friend.dart @@ -18,12 +18,7 @@ class Friend extends CacheModel implements Comparable { required int this.lastActive, required this.following, required this.canPostTexts, - }) : assert(id != null), - assert(accepted != null), - assert(lastActive != null), - assert(following != null), - assert(canPostTexts != null), - super(id: id); + }) : super(id: id); /// Check out whether friend is connected or not bool get isConnected => time() - 30 < lastActive!; @@ -41,8 +36,7 @@ class Friend extends CacheModel implements Comparable { }; Friend.fromMap(Map map) - : assert(map != null), - accepted = map[FriendsListTableContract.C_ACCEPTED] == 1, + : accepted = map[FriendsListTableContract.C_ACCEPTED] == 1, lastActive = map[FriendsListTableContract.C_LAST_ACTIVE], following = map[FriendsListTableContract.C_FOLLOWING] == 1, canPostTexts = map[FriendsListTableContract.C_CAN_POST_TEXTS] == 1, diff --git a/lib/models/new_conversation_message.dart b/lib/models/new_conversation_message.dart index cd08af4..150da45 100644 --- a/lib/models/new_conversation_message.dart +++ b/lib/models/new_conversation_message.dart @@ -17,8 +17,7 @@ class NewConversationMessage { required this.message, this.file, this.thumbnail, - }) : assert(conversationID != null), - assert(file != null || message != null); + }) : assert(file != null || message != null); bool get hasMessage => message != null; diff --git a/lib/ui/dialogs/multi_choices_dialog.dart b/lib/ui/dialogs/multi_choices_dialog.dart index 7088ba7..e3b06aa 100644 --- a/lib/ui/dialogs/multi_choices_dialog.dart +++ b/lib/ui/dialogs/multi_choices_dialog.dart @@ -18,9 +18,7 @@ class MultiChoiceEntry { required this.title, this.subtitle, this.hidden = false, - }) : assert(id != null), - assert(title != null), - assert(hidden != null); + }) : assert(id != null); bool get hasSubtitle => subtitle != null; } diff --git a/lib/ui/widgets/user_writing_in_conv_notifier.dart b/lib/ui/widgets/user_writing_in_conv_notifier.dart index e3b0e77..efdd16f 100644 --- a/lib/ui/widgets/user_writing_in_conv_notifier.dart +++ b/lib/ui/widgets/user_writing_in_conv_notifier.dart @@ -15,8 +15,7 @@ class UserWritingInConvNotifier extends StatefulWidget { final int convID; const UserWritingInConvNotifier({Key? key, required this.convID}) - : assert(convID != null), - super(key: key); + : super(key: key); @override _UserWritingInConvNotifierState createState() => diff --git a/lib/utils/files_utils.dart b/lib/utils/files_utils.dart index cfcce6f..be1bc96 100644 --- a/lib/utils/files_utils.dart +++ b/lib/utils/files_utils.dart @@ -32,8 +32,6 @@ Future pickImage(BuildContext context, /// Throws in case of failure Future generateTemporaryFile() async { final tempDir = await getTemporaryDirectory(); - if (tempDir == null) - throw Exception("Could not generate temporary directory!"); return File(path.join(tempDir.path, randomString(15, from: 65, to: 90))); }