From 06312512a6d0aaba2a3ed8701a27ef3914ed0cc0 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 11 Mar 2022 16:27:01 +0100 Subject: [PATCH] Fix a few notices --- lib/forez/tour/join_group_pane.dart | 3 +-- lib/forez/ui/routes/forez_member_profile_route.dart | 3 +-- lib/forez/ui/routes/forez_route.dart | 4 +--- lib/forez/ui/routes/search_users.dart | 2 +- lib/forez/ui/screens/forez_directory_screen.dart | 7 +------ lib/helpers/events_helper.dart | 4 +--- lib/helpers/groups_helper.dart | 2 +- .../conversation_message_serialization_helper.dart | 3 +-- lib/helpers/survey_helper.dart | 2 -- lib/helpers/virtual_directory_helper.dart | 2 +- lib/models/advanced_group_info.dart | 8 +++----- lib/models/api_request.dart | 12 +++--------- lib/models/call_config.dart | 4 +--- lib/models/conversation_message.dart | 3 +-- lib/models/survey.dart | 12 ++---------- 15 files changed, 19 insertions(+), 52 deletions(-) diff --git a/lib/forez/tour/join_group_pane.dart b/lib/forez/tour/join_group_pane.dart index d4c6d0e..699ced0 100644 --- a/lib/forez/tour/join_group_pane.dart +++ b/lib/forez/tour/join_group_pane.dart @@ -36,8 +36,7 @@ class _JoinGroupPaneBody extends StatefulWidget { const _JoinGroupPaneBody({ Key? key, required this.onUpdated, - }) : assert(onUpdated != null), - super(key: key); + }) : super(key: key); @override JoinGroupPaneBodyState createState() => JoinGroupPaneBodyState(); diff --git a/lib/forez/ui/routes/forez_member_profile_route.dart b/lib/forez/ui/routes/forez_member_profile_route.dart index ce0df1a..e593e5d 100644 --- a/lib/forez/ui/routes/forez_member_profile_route.dart +++ b/lib/forez/ui/routes/forez_member_profile_route.dart @@ -26,8 +26,7 @@ class ForezMemberProfileRoute extends StatefulWidget { const ForezMemberProfileRoute({ Key? key, required this.userID, - }) : assert(userID != null), - super(key: key); + }) : super(key: key); @override _ForezMemberProfileRouteState createState() => diff --git a/lib/forez/ui/routes/forez_route.dart b/lib/forez/ui/routes/forez_route.dart index c9757a1..2f99984 100644 --- a/lib/forez/ui/routes/forez_route.dart +++ b/lib/forez/ui/routes/forez_route.dart @@ -210,7 +210,5 @@ class _Tab { required this.title, required this.widget, this.isUnread, - }) : assert(icon != null), - assert(title != null), - assert(widget != null); + }); } diff --git a/lib/forez/ui/routes/search_users.dart b/lib/forez/ui/routes/search_users.dart index abeb11f..26c677d 100644 --- a/lib/forez/ui/routes/search_users.dart +++ b/lib/forez/ui/routes/search_users.dart @@ -15,7 +15,7 @@ Future searchUser(BuildContext context, UsersList users) async { class _SearchDelegate extends SearchDelegate { final UsersList _usersList; - _SearchDelegate(this._usersList) : assert(_usersList != null); + _SearchDelegate(this._usersList); @override List? buildActions(BuildContext context) => null; diff --git a/lib/forez/ui/screens/forez_directory_screen.dart b/lib/forez/ui/screens/forez_directory_screen.dart index bdc6cb8..717b96d 100644 --- a/lib/forez/ui/screens/forez_directory_screen.dart +++ b/lib/forez/ui/screens/forez_directory_screen.dart @@ -207,12 +207,7 @@ class _MembershipButton extends StatelessWidget { required this.onTap, required this.color, required this.icon, - }) : assert(user != null), - assert(action != null), - assert(onTap != null), - assert(color != null), - assert(icon != null), - super(key: key); + }) : super(key: key); @override Widget build(BuildContext context) => ElevatedButton( diff --git a/lib/helpers/events_helper.dart b/lib/helpers/events_helper.dart index d8dd6bc..19260ef 100644 --- a/lib/helpers/events_helper.dart +++ b/lib/helpers/events_helper.dart @@ -122,9 +122,7 @@ class NewCallSignalEvent { required this.peerID, this.sessionDescription, this.candidate, - }) : assert(callID != null), - assert(peerID != null), - assert(sessionDescription != null || candidate != null); + }) : assert(sessionDescription != null || candidate != null); } /// Call peer ready event diff --git a/lib/helpers/groups_helper.dart b/lib/helpers/groups_helper.dart index 696e384..f128ae1 100644 --- a/lib/helpers/groups_helper.dart +++ b/lib/helpers/groups_helper.dart @@ -51,7 +51,7 @@ class GetAdvancedInfoResult { final GetAdvancedInfoStatus status; final AdvancedGroupInfo? info; - GetAdvancedInfoResult(this.status, this.info) : assert(status != null); + GetAdvancedInfoResult(this.status, this.info); } /// Groups helper diff --git a/lib/helpers/serialization/conversation_message_serialization_helper.dart b/lib/helpers/serialization/conversation_message_serialization_helper.dart index 4175f69..bd18d70 100644 --- a/lib/helpers/serialization/conversation_message_serialization_helper.dart +++ b/lib/helpers/serialization/conversation_message_serialization_helper.dart @@ -15,8 +15,7 @@ class ConversationsMessagesSerializationHelper final int convID; ConversationsMessagesSerializationHelper._(int convID) - : convID = convID, - assert(convID != null); + : convID = convID; factory ConversationsMessagesSerializationHelper(int? convID) { if (_instances == null) _instances = HashMap(); diff --git a/lib/helpers/survey_helper.dart b/lib/helpers/survey_helper.dart index e496389..eea00f2 100644 --- a/lib/helpers/survey_helper.dart +++ b/lib/helpers/survey_helper.dart @@ -26,8 +26,6 @@ class SurveyHelper { /// Send the response of a user to a survey Future respondToSurvey( {required Survey survey, required SurveyChoice choice}) async { - assert(survey != null); - assert(choice != null); return (await APIRequest( uri: "surveys/send_response", diff --git a/lib/helpers/virtual_directory_helper.dart b/lib/helpers/virtual_directory_helper.dart index 06f12ce..f1bc3f4 100644 --- a/lib/helpers/virtual_directory_helper.dart +++ b/lib/helpers/virtual_directory_helper.dart @@ -13,7 +13,7 @@ class VirtualDirectoryResult { const VirtualDirectoryResult({ required this.type, this.id, - }) : assert(type != null); + }); } class VirtualDirectoryHelper { diff --git a/lib/models/advanced_group_info.dart b/lib/models/advanced_group_info.dart index accb034..9ae2307 100644 --- a/lib/models/advanced_group_info.dart +++ b/lib/models/advanced_group_info.dart @@ -37,8 +37,7 @@ class AdvancedGroupInfo extends Group implements LikeElement { required this.userLike, required this.conversations, required this.isForezGroup, - }) : assert(isForezGroup != null), - super( + }) : super( id: id, name: name, iconURL: iconURL, @@ -53,8 +52,7 @@ class AdvancedGroupInfo extends Group implements LikeElement { @override LikesType likeType = LikesType.GROUP; - get hasURL => url != null && url.isNotEmpty && url != "null"; + get hasURL => url.isNotEmpty && url != "null"; - get hasDescription => - description != null && description.isNotEmpty && description != "null"; + get hasDescription => description.isNotEmpty && description != "null"; } diff --git a/lib/models/api_request.dart b/lib/models/api_request.dart index 106f5cb..268afcc 100644 --- a/lib/models/api_request.dart +++ b/lib/models/api_request.dart @@ -32,21 +32,15 @@ class APIRequest { Map files = Map(); Map bytesFiles = Map(); - APIRequest({required this.uri, this.needLogin = false, this.args}) - : assert(uri != null), - assert(needLogin != null) { + APIRequest({required this.uri, this.needLogin = false, this.args}) { if (this.args == null) this.args = Map(); } - APIRequest.withLogin(this.uri, {this.args}) - : needLogin = true, - assert(uri != null) { + APIRequest.withLogin(this.uri, {this.args}) : needLogin = true { if (args == null) this.args = Map(); } - APIRequest.withoutLogin(this.uri, {this.args}) - : needLogin = false, - assert(uri != null) { + APIRequest.withoutLogin(this.uri, {this.args}) : needLogin = false { if (args == null) this.args = Map(); } diff --git a/lib/models/call_config.dart b/lib/models/call_config.dart index 20e4829..62207dd 100644 --- a/lib/models/call_config.dart +++ b/lib/models/call_config.dart @@ -1,5 +1,3 @@ - - /// Call configuration /// /// @author Pierre Hubert @@ -9,7 +7,7 @@ class CallConfig { const CallConfig({ required this.iceServers, - }) : assert(iceServers != null); + }); /// Turn this call configuration into the right for the WebRTC plugin Map get pluginConfig => { diff --git a/lib/models/conversation_message.dart b/lib/models/conversation_message.dart index 5b62052..76e3cc8 100644 --- a/lib/models/conversation_message.dart +++ b/lib/models/conversation_message.dart @@ -112,8 +112,7 @@ class ConversationServerMessage { required this.userAdded, required this.userWhoRemoved, required this.userRemoved, - }) : assert(type != null), - assert(userID != null || + }) : assert(userID != null || (type != ConversationServerMessageType.USER_CREATED_CONVERSATION && type != ConversationServerMessageType.USER_LEFT_CONV)), assert((userWhoAdded != null && userAdded != null) || diff --git a/lib/models/survey.dart b/lib/models/survey.dart index 304ead1..089154b 100644 --- a/lib/models/survey.dart +++ b/lib/models/survey.dart @@ -24,17 +24,9 @@ class Survey { required this.userChoice, required this.choices, required this.allowNewChoicesCreation, - }) : assert(id != null), - assert(userID != null), - assert(postID != null), - assert(creationTime != null), - assert(question != null), - assert(userChoice != null), - assert(choices != null), - assert(choices.length > 0), - assert(allowNewChoicesCreation != null); + }) : assert(choices.length > 0); - bool get hasResponded => this.userChoice != null && this.userChoice > 0; + bool get hasResponded => this.userChoice > 0; bool get hasResponses => this.choices.where((f) => f.responses > 0).length > 0;