diff --git a/lib/ui/routes/conversation_message_stats_route.dart b/lib/ui/routes/conversation_message_stats_route.dart index 38328d1..ae9edfd 100644 --- a/lib/ui/routes/conversation_message_stats_route.dart +++ b/lib/ui/routes/conversation_message_stats_route.dart @@ -21,9 +21,7 @@ class ConversationMessageStatsRoute extends StatefulWidget { Key? key, required this.conv, required this.message, - }) : assert(conv != null), - assert(message != null), - super(key: key); + }) : super(key: key); @override _ConversationMessageStatsRouteState createState() => diff --git a/lib/ui/routes/conversation_route.dart b/lib/ui/routes/conversation_route.dart index 7dd19bb..b1dc064 100644 --- a/lib/ui/routes/conversation_route.dart +++ b/lib/ui/routes/conversation_route.dart @@ -21,8 +21,7 @@ class ConversationRoute extends StatefulWidget { const ConversationRoute({ Key? key, required this.conversationID, - }) : assert(conversationID != null), - super(key: key); + }) : super(key: key); @override State createState() => _ConversationRouteState(); @@ -69,7 +68,7 @@ class _ConversationRouteState extends SafeState { Widget _buildRouteBody() { //Handle errors - if (_error != null && _error) + if (_error) return buildErrorCard( tr("Could not get conversation information!"), actions: [ diff --git a/lib/ui/routes/forez_presence_settings_route.dart b/lib/ui/routes/forez_presence_settings_route.dart index 123e01a..60088bb 100644 --- a/lib/ui/routes/forez_presence_settings_route.dart +++ b/lib/ui/routes/forez_presence_settings_route.dart @@ -26,8 +26,7 @@ class PresenceSettings extends StatefulWidget { const PresenceSettings({ Key? key, required this.groupID, - }) : assert(groupID != null), - super(key: key); + }) : super(key: key); @override _PresenceSettingsState createState() => _PresenceSettingsState(); diff --git a/lib/ui/routes/forgot_password_route.dart b/lib/ui/routes/forgot_password_route.dart index 242cc00..579751a 100644 --- a/lib/ui/routes/forgot_password_route.dart +++ b/lib/ui/routes/forgot_password_route.dart @@ -82,8 +82,6 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> { case _SelectedOption.SECURITY_QUESTIONS: return _buildSecurityQuestionsScreen(); } - - throw Exception("Unreachable statement!"); } Widget _buildEnterEmailAddressScreen() { @@ -120,7 +118,7 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> { _setLoading(true); // Check if email address exists or not - if (!await AccountHelper.existsMailAccount(_inputEmail) ) { + if (!await AccountHelper.existsMailAccount(_inputEmail)) { _setLoading(false); showSimpleSnack(context, tr("Specified email address was not found!")!); return; @@ -169,7 +167,8 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> { context: context, builder: (c) => AlertDialog( title: Text("Contact us"), - content: Text(tr("You can reach us at contact@communiquons.org")!), + content: + Text(tr("You can reach us at contact@communiquons.org")!), actions: [CancelDialogButton()], )); } diff --git a/lib/ui/routes/full_screen_image.dart b/lib/ui/routes/full_screen_image.dart index ebb0291..c568c6d 100644 --- a/lib/ui/routes/full_screen_image.dart +++ b/lib/ui/routes/full_screen_image.dart @@ -11,7 +11,7 @@ import 'package:url_launcher/url_launcher.dart'; class FullScreenImageRoute extends StatefulWidget { final String url; - FullScreenImageRoute(this.url) : assert(url != null); + FullScreenImageRoute(this.url); @override _FullScreenImageRouteState createState() => _FullScreenImageRouteState(); diff --git a/lib/ui/routes/main_route/page_info.dart b/lib/ui/routes/main_route/page_info.dart index f4e3d96..9585d27 100644 --- a/lib/ui/routes/main_route/page_info.dart +++ b/lib/ui/routes/main_route/page_info.dart @@ -31,8 +31,5 @@ class PageInfo { this.id, this.hideNavBar = false, this.canShowAsDialog = false, - }) : assert(type != null), - assert(child != null), - assert(hideNavBar != null), - assert(canShowAsDialog != null); + }); } diff --git a/lib/ui/routes/password_reset_route.dart b/lib/ui/routes/password_reset_route.dart index 3f2f2a8..a2c8e20 100644 --- a/lib/ui/routes/password_reset_route.dart +++ b/lib/ui/routes/password_reset_route.dart @@ -19,8 +19,7 @@ class PasswordResetRoute extends StatelessWidget { const PasswordResetRoute({ Key? key, required this.token, - }) : assert(token != null), - super(key: key); + }) : super(key: key); @override Widget build(BuildContext context) { @@ -39,8 +38,7 @@ class _PasswordResetBody extends StatefulWidget { final String token; const _PasswordResetBody({Key? key, required this.token}) - : assert(token != null), - super(key: key); + : super(key: key); @override __PasswordResetBodyState createState() => __PasswordResetBodyState(); diff --git a/lib/ui/routes/push_notifications_route.dart b/lib/ui/routes/push_notifications_route.dart index ea861d0..89c988c 100644 --- a/lib/ui/routes/push_notifications_route.dart +++ b/lib/ui/routes/push_notifications_route.dart @@ -140,7 +140,7 @@ class PushNotificationsConfigurationWidgetState srvConfig!.notificationsPolicy.hasIndependent && isAndroid, onChanged: (s) { setState(() => currStatus = s); - if (widget.onChanged != null) widget.onChanged(); + widget.onChanged(); }, ), SizedBox(height: 5), @@ -151,7 +151,7 @@ class PushNotificationsConfigurationWidgetState available: true, onChanged: (s) { setState(() => currStatus = s); - if (widget.onChanged != null) widget.onChanged(); + widget.onChanged(); }, ), ], @@ -195,12 +195,7 @@ class _NotificationOption extends StatelessWidget { required this.current, required this.available, required this.onChanged, - }) : assert(title != null), - assert(option != null), - assert(current != null), - assert(available != null), - assert(onChanged != null), - super(key: key); + }) : super(key: key); @override Widget build(BuildContext context) => !available diff --git a/lib/ui/routes/settings/account_privacy_settings.dart b/lib/ui/routes/settings/account_privacy_settings.dart index 6ee4145..e05314c 100644 --- a/lib/ui/routes/settings/account_privacy_settings.dart +++ b/lib/ui/routes/settings/account_privacy_settings.dart @@ -180,9 +180,7 @@ class DataConservationPolicyTile extends SettingsTile { required this.title, required this.onChange, required this.minValue, - }) : assert(title != null), - assert(onChange != null), - assert(minValue != null); + }); @override Widget build(BuildContext context) { diff --git a/lib/ui/routes/settings/account_security_settings.dart b/lib/ui/routes/settings/account_security_settings.dart index 22ee0e9..0c6a914 100644 --- a/lib/ui/routes/settings/account_security_settings.dart +++ b/lib/ui/routes/settings/account_security_settings.dart @@ -140,8 +140,7 @@ class _SecurityQuestionsDialog extends StatefulWidget { final SecuritySettings settings; const _SecurityQuestionsDialog({Key? key, required this.settings}) - : assert(settings != null), - super(key: key); + : super(key: key); @override __SecurityQuestionsDialogState createState() => diff --git a/lib/ui/routes/settings/account_settings_route.dart b/lib/ui/routes/settings/account_settings_route.dart index 5011775..04758a6 100644 --- a/lib/ui/routes/settings/account_settings_route.dart +++ b/lib/ui/routes/settings/account_settings_route.dart @@ -31,10 +31,7 @@ class _SettingsSection { required this.subtitle, required this.icon, required this.onBuild, - }) : assert(title != null), - assert(subtitle != null), - assert(icon != null), - assert(onBuild != null); + }); } class AccountSettingsRoute extends StatelessWidget { diff --git a/lib/ui/routes/single_post_route.dart b/lib/ui/routes/single_post_route.dart index 709e2a8..6bdb6ea 100644 --- a/lib/ui/routes/single_post_route.dart +++ b/lib/ui/routes/single_post_route.dart @@ -14,8 +14,7 @@ class SinglePostRoute extends StatelessWidget { const SinglePostRoute({ Key? key, required this.postID, - }) : assert(postID != null), - super(key: key); + }) : super(key: key); @override Widget build(BuildContext context) { @@ -34,8 +33,7 @@ class _SinglePostRouteBody extends StatefulWidget { const _SinglePostRouteBody({ Key? key, required this.postID, - }) : assert(postID != null), - super(key: key); + }) : super(key: key); @override __SinglePostRouteBodyState createState() => __SinglePostRouteBodyState(); diff --git a/lib/ui/routes/update_conversation_route.dart b/lib/ui/routes/update_conversation_route.dart index cd5eb2c..7561d0e 100644 --- a/lib/ui/routes/update_conversation_route.dart +++ b/lib/ui/routes/update_conversation_route.dart @@ -9,8 +9,7 @@ class UpdateConversationRoute extends StatefulWidget { final int conversationID; const UpdateConversationRoute({Key? key, required this.conversationID}) - : assert(conversationID != null), - super(key: key); + : super(key: key); @override State createState() => _UpdateConversationRoute(); diff --git a/lib/ui/routes/video_player_route.dart b/lib/ui/routes/video_player_route.dart index f615f6e..240e69b 100644 --- a/lib/ui/routes/video_player_route.dart +++ b/lib/ui/routes/video_player_route.dart @@ -15,8 +15,7 @@ class VideoPlayerRoute extends StatefulWidget { const VideoPlayerRoute({ Key? key, required this.url, - }) : assert(url != null), - super(key: key); + }) : super(key: key); @override _VideoPlayerRouteState createState() => _VideoPlayerRouteState(); diff --git a/lib/ui/screens/authorized_group_page_screen.dart b/lib/ui/screens/authorized_group_page_screen.dart index fcce8cf..c3ab2ef 100644 --- a/lib/ui/screens/authorized_group_page_screen.dart +++ b/lib/ui/screens/authorized_group_page_screen.dart @@ -35,9 +35,7 @@ class AuthorizedGroupPageScreen extends StatefulWidget { required this.advancedGroupInfo, required this.conversationID, required this.needRefresh, - }) : assert(advancedGroupInfo != null), - assert(needRefresh != null), - super(key: key); + }) : super(key: key); @override _AuthorizedGroupPageScreenState createState() => @@ -210,9 +208,7 @@ class _GroupPageTab { required this.widget, this.visible = true, required this.label, - }) : assert(widget != null), - assert(visible != null), - assert(label != null); + }); Tab get tab => Tab(text: label); } diff --git a/lib/ui/screens/call_screen.dart b/lib/ui/screens/call_screen.dart index dff747e..a9f9e5d 100644 --- a/lib/ui/screens/call_screen.dart +++ b/lib/ui/screens/call_screen.dart @@ -46,9 +46,7 @@ class CallScreen extends StatefulWidget { this.floatingButtons = true, this.buildCustomAppBar, this.onClose, - }) : assert(convID != null), - assert(convID > 0), - assert(floatingButtons != null), + }) : assert(convID > 0), super(key: key); @override @@ -694,10 +692,7 @@ class _FooterButton extends StatelessWidget { this.width = 45, this.bgColor = Colors.black, required this.roundedButtons, - }) : assert(icon != null), - assert(visible != null), - assert(roundedButtons != null), - super(key: key); + }) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/ui/screens/conversation_members_screen.dart b/lib/ui/screens/conversation_members_screen.dart index 6cafe18..06d8c67 100644 --- a/lib/ui/screens/conversation_members_screen.dart +++ b/lib/ui/screens/conversation_members_screen.dart @@ -17,8 +17,7 @@ class ConversationMembersScreen extends StatefulWidget { const ConversationMembersScreen({ Key? key, required this.convID, - }) : assert(convID != null), - super(key: key); + }) : super(key: key); @override _ConversationMembersScreenState createState() => diff --git a/lib/ui/screens/conversation_screen.dart b/lib/ui/screens/conversation_screen.dart index 3e9967c..6371227 100644 --- a/lib/ui/screens/conversation_screen.dart +++ b/lib/ui/screens/conversation_screen.dart @@ -43,8 +43,7 @@ class ConversationScreen extends StatefulWidget { final int conversationID; const ConversationScreen({Key? key, required this.conversationID}) - : assert(conversationID != null), - super(key: key); + : super(key: key); @override State createState() => _ConversationScreenState(); @@ -667,7 +666,9 @@ class _ConversationScreenState extends SafeState { ? _buildLoadingOlderMessage() : null, ), - _messages!.length == 0 ? _buildNoMessagesNotice() : _buildMessagesList(), + _messages!.length == 0 + ? _buildNoMessagesNotice() + : _buildMessagesList(), UserWritingInConvNotifier(convID: _conversation.id!), _sendCancel != null ? _buildSendingWidget() : _buildSendMessageForm(), _showEmojiPicker ? _buildEmojiContainer() : Container(), diff --git a/lib/ui/screens/conversations_list_screen.dart b/lib/ui/screens/conversations_list_screen.dart index dd4d97e..339cbae 100644 --- a/lib/ui/screens/conversations_list_screen.dart +++ b/lib/ui/screens/conversations_list_screen.dart @@ -27,8 +27,7 @@ class ConversationsListScreen extends StatefulWidget { Key? key, this.useSmallFAB = false, this.onOpen, - }) : assert(useSmallFAB != null), - super(key: key); + }) : super(key: key); @override State createState() => _ConversationScreenState(); @@ -74,7 +73,6 @@ class _ConversationScreenState extends SafeState { ConversationsList list = cached ? await _conversationsHelper.getCachedList() : await _conversationsHelper.downloadList(); - assert(list != null); // Get information about the members of the conversations _users = await _usersHelper.getList(list.allUsersID); @@ -145,7 +143,7 @@ class _ConversationScreenState extends SafeState { "Do you really want to leave this conversation ? As you are its last admin, it will be completely deleted!") : tr("Do you really want to leave this conversation ?")); - if (result == null || !result) return; + if (!result) return; // Request the conversation to be deleted now try { diff --git a/lib/ui/screens/group_access_denied_screen.dart b/lib/ui/screens/group_access_denied_screen.dart index cf9297e..424e357 100644 --- a/lib/ui/screens/group_access_denied_screen.dart +++ b/lib/ui/screens/group_access_denied_screen.dart @@ -19,9 +19,7 @@ class GroupAccessDeniedScreen extends StatefulWidget { Key? key, required this.groupID, required this.onMembershipAcquired, - }) : assert(groupID != null), - assert(onMembershipAcquired != null), - super(key: key); + }) : super(key: key); @override _GroupAccessDeniedScreenState createState() => diff --git a/lib/ui/screens/group_screen.dart b/lib/ui/screens/group_screen.dart index 185aa4a..a9e72b5 100644 --- a/lib/ui/screens/group_screen.dart +++ b/lib/ui/screens/group_screen.dart @@ -18,8 +18,7 @@ class GroupPageScreen extends StatefulWidget { Key? key, required this.groupID, this.conversationID, - }) : assert(groupID != null), - super(key: key); + }) : super(key: key); @override _GroupPageScreenState createState() => _GroupPageScreenState(); diff --git a/lib/ui/screens/group_sections/about_group_section.dart b/lib/ui/screens/group_sections/about_group_section.dart index 2f80ebc..d6ab37d 100644 --- a/lib/ui/screens/group_sections/about_group_section.dart +++ b/lib/ui/screens/group_sections/about_group_section.dart @@ -15,8 +15,7 @@ class AboutGroupSection extends StatelessWidget { const AboutGroupSection({ Key? key, required this.group, - }) : assert(group != null), - super(key: key); + }) : super(key: key); @override Widget build(BuildContext context) => ListView( @@ -51,8 +50,8 @@ class AboutGroupSection extends StatelessWidget { ListTile( leading: Icon(Icons.group), title: Text(tr("Members")!), - subtitle: Text( - tr("%1% members", args: {"1": group.numberMembers.toString()})!), + subtitle: Text(tr("%1% members", + args: {"1": group.numberMembers.toString()})!), ), // Who can create posts @@ -92,8 +91,8 @@ class AboutGroupSection extends StatelessWidget { ListTile( leading: Icon(Icons.remove_red_eye), title: Text(tr("Members list visibility")!), - subtitle: - Text(group.isMembersListPublic! ? tr("Public")! : tr("Private")!), + subtitle: Text( + group.isMembersListPublic! ? tr("Public")! : tr("Private")!), ), group.isForezGroup diff --git a/lib/ui/screens/group_sections/forez_presence_section.dart b/lib/ui/screens/group_sections/forez_presence_section.dart index 952e3f0..b424867 100644 --- a/lib/ui/screens/group_sections/forez_presence_section.dart +++ b/lib/ui/screens/group_sections/forez_presence_section.dart @@ -18,8 +18,7 @@ class ForezPresenceSection extends StatefulWidget { const ForezPresenceSection({ Key? key, required this.groupID, - }) : assert(groupID != null), - super(key: key); + }) : super(key: key); @override _ForezPresenceSectionState createState() => _ForezPresenceSectionState(); diff --git a/lib/ui/screens/group_sections/group_conversation_section.dart b/lib/ui/screens/group_sections/group_conversation_section.dart index 1ab4bfe..da2cc2c 100644 --- a/lib/ui/screens/group_sections/group_conversation_section.dart +++ b/lib/ui/screens/group_sections/group_conversation_section.dart @@ -14,8 +14,7 @@ class GroupConversationSection extends StatelessWidget { const GroupConversationSection({ Key? key, required this.conv, - }) : assert(conv != null), - super(key: key); + }) : super(key: key); @override Widget build(BuildContext context) => Stack( diff --git a/lib/ui/screens/group_sections/group_members_screen.dart b/lib/ui/screens/group_sections/group_members_screen.dart index 05900ef..023e75e 100644 --- a/lib/ui/screens/group_sections/group_members_screen.dart +++ b/lib/ui/screens/group_sections/group_members_screen.dart @@ -22,8 +22,7 @@ class GroupMembersSection extends StatefulWidget { final int groupID; const GroupMembersSection({Key? key, required this.groupID}) - : assert(groupID != null), - super(key: key); + : super(key: key); @override _GroupMembersSectionState createState() => _GroupMembersSectionState(); @@ -143,11 +142,7 @@ class _GroupMembershipTile extends StatefulWidget { required this.membership, required this.user, required this.onUpdated, - }) : assert(group != null), - assert(membership != null), - assert(user != null), - assert(onUpdated != null), - super(key: key); + }) : super(key: key); @override __GroupMembershipTileState createState() => __GroupMembershipTileState(); @@ -182,15 +177,12 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> { case GroupMembershipLevel.MODERATOR: case GroupMembershipLevel.MEMBER: return _buildMemberCase(); - break; case GroupMembershipLevel.INVITED: return _buildInvitedCase(); - break; case GroupMembershipLevel.PENDING: return _buildRequestedCase(); - break; case GroupMembershipLevel.VISITOR: // This case should never happen diff --git a/lib/ui/screens/group_sections/group_posts_section.dart b/lib/ui/screens/group_sections/group_posts_section.dart index 6f6af21..e8a7ada 100644 --- a/lib/ui/screens/group_sections/group_posts_section.dart +++ b/lib/ui/screens/group_sections/group_posts_section.dart @@ -14,8 +14,7 @@ class GroupPostsSection extends StatefulWidget { const GroupPostsSection({ Key? key, required this.group, - }) : assert(group != null), - super(key: key); + }) : super(key: key); @override _GroupPostsSectionState createState() => _GroupPostsSectionState(); diff --git a/lib/ui/screens/notifications_screen.dart b/lib/ui/screens/notifications_screen.dart index cab78a7..7876762 100644 --- a/lib/ui/screens/notifications_screen.dart +++ b/lib/ui/screens/notifications_screen.dart @@ -30,8 +30,7 @@ class NotificationsScreen extends StatefulWidget { const NotificationsScreen({ Key? key, this.useSmallDeleteButton = false, - }) : assert(useSmallDeleteButton != null), - super(key: key); + }) : super(key: key); @override _NotificationsScreenState createState() => _NotificationsScreenState();