diff --git a/lib/models/user.dart b/lib/models/user.dart index ced6149..5cfb9b5 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -30,7 +30,7 @@ class User implements SerializableElement { }) : assert(id > 0); /// Get user full name - String get fullName => firstName! + " " + lastName!; + String get fullName => firstName + " " + lastName; /// Get user display name String get displayName => htmlDecodeCharacters(fullName); diff --git a/lib/ui/routes/push_notifications_route.dart b/lib/ui/routes/push_notifications_route.dart index d93c423..ea861d0 100644 --- a/lib/ui/routes/push_notifications_route.dart +++ b/lib/ui/routes/push_notifications_route.dart @@ -51,7 +51,7 @@ class _PushNotificationsConfigurationRouteState ), Spacer(), OutlinedButton( - onPressed: _key?.currentState?.canSubmit ?? false + onPressed: _key.currentState?.canSubmit ?? false ? _key.currentState!.submit : null, child: Text(tr("Configure")!.toUpperCase()), diff --git a/lib/ui/routes/tour_route.dart b/lib/ui/routes/tour_route.dart index 4e20fc5..92ca7cc 100644 --- a/lib/ui/routes/tour_route.dart +++ b/lib/ui/routes/tour_route.dart @@ -123,7 +123,7 @@ class TourRouteState extends State { ..removeWhere((pane) { if (pane is PresentationPane) { PresentationPane p = pane; - return !(p.visible ?? true); + return !(p.visible); } return false; }); @@ -222,7 +222,7 @@ class __RouteBodyState extends State<_RouteBody> { _controller!.animateTo(_controller!.index + 1); } else { - (await PreferencesHelper.getInstance())! + (await PreferencesHelper.getInstance()) .setBool(PreferencesKeyList.IS_TOUR_SEEN, true); Navigator.of(context).pop(); } diff --git a/lib/ui/screens/notifications_screen.dart b/lib/ui/screens/notifications_screen.dart index 31cf7e6..4c8f74f 100644 --- a/lib/ui/screens/notifications_screen.dart +++ b/lib/ui/screens/notifications_screen.dart @@ -316,6 +316,9 @@ class _NotificationTile extends StatelessWidget { case _PopupMenuActions.DELETE: onDelete(notification); break; + + default: + break; } } diff --git a/lib/ui/screens/other_friends_lists_screen.dart b/lib/ui/screens/other_friends_lists_screen.dart index 5adc64a..71b0b9d 100644 --- a/lib/ui/screens/other_friends_lists_screen.dart +++ b/lib/ui/screens/other_friends_lists_screen.dart @@ -88,7 +88,7 @@ class _OtherUserFriendsListScreenState user: _usersInfo!.getUser(_friendsList.elementAt(i)), onTap: (u) => openUserPage( context: context, - userID: u.id!, + userID: u.id, ), ), ), diff --git a/lib/ui/screens/search_screen.dart b/lib/ui/screens/search_screen.dart index c2fc142..3566e2b 100644 --- a/lib/ui/screens/search_screen.dart +++ b/lib/ui/screens/search_screen.dart @@ -97,7 +97,7 @@ class _SearchResultUser extends StatelessWidget { user: user, ), title: Text(user.displayName), - onTap: () => MainController.of(context)!.openUserPage(user.id!), + onTap: () => MainController.of(context)!.openUserPage(user.id), ); } } diff --git a/lib/ui/screens/unread_conversations_screen.dart b/lib/ui/screens/unread_conversations_screen.dart index d71558b..6ac0fee 100644 --- a/lib/ui/screens/unread_conversations_screen.dart +++ b/lib/ui/screens/unread_conversations_screen.dart @@ -102,7 +102,7 @@ class _UnreadConversationsScreenState ? _groups!.getGroup(conv.conv.groupID) : null, ), - title: Text(ConversationsHelper.getConversationName(conv.conv, _users)!), + title: Text(ConversationsHelper.getConversationName(conv.conv, _users)), subtitle: RichText( text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [ TextSpan( diff --git a/lib/ui/screens/update_conversation_screen.dart b/lib/ui/screens/update_conversation_screen.dart index b426b38..b7c2834 100644 --- a/lib/ui/screens/update_conversation_screen.dart +++ b/lib/ui/screens/update_conversation_screen.dart @@ -282,7 +282,7 @@ class _UpdateConversationScreen extends State { void _toggleAdminStatus(User user) async { try { final setAdmin = !_admins.contains(user.id); - await ConversationsHelper.setAdmin(_conversation.id!, user.id!, setAdmin); + await ConversationsHelper.setAdmin(_conversation.id!, user.id, setAdmin); setState(() { if (!setAdmin) diff --git a/lib/ui/tiles/accepted_friend_tile.dart b/lib/ui/tiles/accepted_friend_tile.dart index 7a68a36..c171019 100644 --- a/lib/ui/tiles/accepted_friend_tile.dart +++ b/lib/ui/tiles/accepted_friend_tile.dart @@ -40,7 +40,7 @@ class AcceptedFriendTile extends StatelessWidget { @override Widget build(BuildContext context) { return ListTile( - onTap: () => openUserPage(context: context, userID: user.id!), + onTap: () => openUserPage(context: context, userID: user.id), leading: AccountImageWidget(user: user), title: Text(user.displayName), subtitle: friend.isConnected diff --git a/lib/ui/tiles/conversation_message_tile.dart b/lib/ui/tiles/conversation_message_tile.dart index 494158c..6fa5d19 100644 --- a/lib/ui/tiles/conversation_message_tile.dart +++ b/lib/ui/tiles/conversation_message_tile.dart @@ -64,7 +64,7 @@ class ConversationMessageTile extends StatelessWidget { onSelected: (v) => _menuOptionSelected(context, v), itemBuilder: (c) => >[ PopupMenuItem( - enabled: (message.message?.content ?? "") != "", + enabled: (message.message.content ?? "") != "", value: _MenuChoices.COPY_MESSAGE, child: Text(tr("Copy message")!), ), diff --git a/lib/ui/tiles/conversation_tile.dart b/lib/ui/tiles/conversation_tile.dart index 0823ebe..2afd980 100644 --- a/lib/ui/tiles/conversation_tile.dart +++ b/lib/ui/tiles/conversation_tile.dart @@ -68,7 +68,7 @@ class ConversationTile extends StatelessWidget { ConversationsHelper.getConversationName( conversation, usersList, - )!, + ), style: TextStyle( fontWeight: conversation.sawLastMessage ? null : FontWeight.bold, ), @@ -162,6 +162,9 @@ class ConversationTile extends StatelessWidget { case _PopupMenuChoices.LEAVE: onRequestLeave(conversation); break; + + default: + break; } } } diff --git a/lib/ui/tiles/post_tile.dart b/lib/ui/tiles/post_tile.dart index 20928c5..2d91111 100644 --- a/lib/ui/tiles/post_tile.dart +++ b/lib/ui/tiles/post_tile.dart @@ -114,7 +114,7 @@ class _PostTileState extends State { child: AccountImageWidget(user: _user), onTap: widget.userNamesClickable ? () => openUserPage( - userID: _user.id!, + userID: _user.id, context: context, ) : null, diff --git a/lib/ui/widgets/account_image_widget.dart b/lib/ui/widgets/account_image_widget.dart index 8c8c68e..97502b5 100644 --- a/lib/ui/widgets/account_image_widget.dart +++ b/lib/ui/widgets/account_image_widget.dart @@ -23,7 +23,7 @@ class AccountImageWidget extends StatelessWidget { Widget build(BuildContext context) { return Material( child: CachedNetworkImage( - imageUrl: user.accountImageURL!, + imageUrl: user.accountImageURL, width: width, height: width, fit: BoxFit.cover, diff --git a/lib/ui/widgets/mobile_mode/mobile_appbar_widget.dart b/lib/ui/widgets/mobile_mode/mobile_appbar_widget.dart index 8df7197..ae8566f 100644 --- a/lib/ui/widgets/mobile_mode/mobile_appbar_widget.dart +++ b/lib/ui/widgets/mobile_mode/mobile_appbar_widget.dart @@ -217,6 +217,8 @@ class _ComunicMobileAppBarState extends SafeState { case BarCallbackActions.ACTION_LOGOUT: controller!.requestLogout(); break; + default: + break; } } } diff --git a/lib/ui/widgets/tablet_mode/global_search_field.dart b/lib/ui/widgets/tablet_mode/global_search_field.dart index e71f44d..220afe9 100644 --- a/lib/ui/widgets/tablet_mode/global_search_field.dart +++ b/lib/ui/widgets/tablet_mode/global_search_field.dart @@ -169,7 +169,7 @@ class _SearchResultsWidget extends StatelessWidget { leading: AccountImageWidget(user: user), title: Text(user.displayName), onTap: () { - MainController.of(context)!.openUserPage(user.id!); + MainController.of(context)!.openUserPage(user.id); onTap(); }, ); @@ -185,6 +185,5 @@ class _SearchResultsWidget extends StatelessWidget { }, ); } - throw Exception("Unreachable statement!"); } } diff --git a/lib/ui/widgets/tablet_mode/memberships_panel.dart b/lib/ui/widgets/tablet_mode/memberships_panel.dart index e567dee..95194a5 100644 --- a/lib/ui/widgets/tablet_mode/memberships_panel.dart +++ b/lib/ui/widgets/tablet_mode/memberships_panel.dart @@ -105,8 +105,6 @@ class _MembershipsPanelState extends SafeState { case MembershipType.CONVERSATION: return _buildConversationMembership(membership); } - - throw Exception("Unreachable statement!"); } // TODO : add private messages icon support @@ -156,7 +154,7 @@ class _MembershipsPanelState extends SafeState { leading: AccountImageWidget(user: user, width: _MembershipIconsWidth), title: Text(user.displayName), subtitle: subtitle, - onTap: () => MainController.of(context)!.openUserPage(user.id!), + onTap: () => MainController.of(context)!.openUserPage(user.id), ), ); } @@ -237,7 +235,7 @@ class _MembershipsPanelState extends SafeState { SizedBox(width: 5), Expanded( child: Text(ConversationsHelper.getConversationName( - conversation, _usersList)!), + conversation, _usersList)), ), ], ), diff --git a/lib/ui/widgets/tour/tour_notifications_pane.dart b/lib/ui/widgets/tour/tour_notifications_pane.dart index 9efac54..0bf63ec 100644 --- a/lib/ui/widgets/tour/tour_notifications_pane.dart +++ b/lib/ui/widgets/tour/tour_notifications_pane.dart @@ -27,7 +27,7 @@ class TourNotificationsPane extends PresentationPane { onConfigured: onConfigured, onChanged: onChanged, ), - canGoNext: pushNotificationsKey?.currentState?.canSubmit ?? false, + canGoNext: pushNotificationsKey.currentState?.canSubmit ?? false, onTapNext: (c) => pushNotificationsKey.currentState!.submit(), visible: visible, ); diff --git a/lib/utils/bbcode_parser.dart b/lib/utils/bbcode_parser.dart index 1b3e743..1567ff1 100644 --- a/lib/utils/bbcode_parser.dart +++ b/lib/utils/bbcode_parser.dart @@ -58,9 +58,9 @@ class BBCodeParsedWidget extends StatelessWidget { int? lastBeginPos = pos; int childNumber = 0; bool stop = false; - while (!stop && pos! < text.length) { + while (!stop && pos < text.length) { //Go to next stop - while (!stop && pos! < text.length) { + while (!stop && pos < text.length) { if (text[pos] == '[') break; pos++; }