diff --git a/packages/dynamite/dynamite/lib/src/helpers/type_result.dart b/packages/dynamite/dynamite/lib/src/helpers/type_result.dart index ca1727e0..3bc8f104 100644 --- a/packages/dynamite/dynamite/lib/src/helpers/type_result.dart +++ b/packages/dynamite/dynamite/lib/src/helpers/type_result.dart @@ -6,7 +6,7 @@ String valueToEscapedValue(final TypeResult result, final String value) { return "'$value'"; } if (result is TypeResultList) { - return 'const $value'; + return 'const <${result.subType.name}>$value'; } if (result is TypeResultEnum) { return '${result.name}.${toDartName(value)}'; diff --git a/packages/dynamite/dynamite_runtime/test/content_string_test.dart b/packages/dynamite/dynamite_runtime/test/content_string_test.dart index c80e2214..5100fdb3 100644 --- a/packages/dynamite/dynamite_runtime/test/content_string_test.dart +++ b/packages/dynamite/dynamite_runtime/test/content_string_test.dart @@ -1,4 +1,4 @@ -// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_redundant_argument_values, inference_failure_on_instance_creation import 'dart:convert'; diff --git a/packages/neon/neon/lib/src/pages/home.dart b/packages/neon/neon/lib/src/pages/home.dart index 7866ce61..44c5c057 100644 --- a/packages/neon/neon/lib/src/pages/home.dart +++ b/packages/neon/neon/lib/src/pages/home.dart @@ -99,7 +99,7 @@ class _HomePageState extends State { Future _showProblem(final String title) async { final colorScheme = Theme.of(context).colorScheme; - await showDialog( + await showDialog( context: context, builder: (final context) => AlertDialog( title: Text(title), diff --git a/packages/neon/neon/lib/src/utils/global.dart b/packages/neon/neon/lib/src/utils/global.dart index 7fcef20d..4305e33f 100644 --- a/packages/neon/neon/lib/src/utils/global.dart +++ b/packages/neon/neon/lib/src/utils/global.dart @@ -5,6 +5,6 @@ import 'package:neon/src/models/push_notification.dart'; class Global { const Global._(); - static Function(String accountID)? onPushNotificationReceived; - static Function(PushNotification notification)? onPushNotificationClicked; + static Future Function(String accountID)? onPushNotificationReceived; + static Future Function(PushNotification notification)? onPushNotificationClicked; } diff --git a/packages/neon/neon/lib/src/utils/global_popups.dart b/packages/neon/neon/lib/src/utils/global_popups.dart index 1b96bc2d..b4a35f67 100644 --- a/packages/neon/neon/lib/src/utils/global_popups.dart +++ b/packages/neon/neon/lib/src/utils/global_popups.dart @@ -72,7 +72,7 @@ class GlobalPopups { return; } - await showDialog( + await showDialog( context: _context, builder: (final context) => AlertDialog( title: Text(AppLocalizations.of(context).nextPushSupported), diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index f54e4e51..0880f97c 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -89,7 +89,7 @@ class PushUtils { await localNotificationsPlugin.cancel(_getNotificationID(instance, pushNotification)); } else if (pushNotification.subject.deleteAll ?? false) { await localNotificationsPlugin.cancelAll(); - Global.onPushNotificationReceived?.call(instance); + await Global.onPushNotificationReceived?.call(instance); } else if (pushNotification.type == 'background') { debugPrint('Got unknown background notification ${json.encode(pushNotification.toJson())}'); } else { @@ -174,7 +174,7 @@ class PushUtils { } } - Global.onPushNotificationReceived?.call(instance); + await Global.onPushNotificationReceived?.call(instance); } } diff --git a/packages/neon/neon/lib/src/widgets/account_switcher_button.dart b/packages/neon/neon/lib/src/widgets/account_switcher_button.dart index f06c29ad..b27a508f 100644 --- a/packages/neon/neon/lib/src/widgets/account_switcher_button.dart +++ b/packages/neon/neon/lib/src/widgets/account_switcher_button.dart @@ -28,7 +28,7 @@ class AccountSwitcherButton extends StatelessWidget { title: Text(AppLocalizations.of(context).settingsAccountManage), onTap: () { Navigator.of(context).pop(); - const SettingsRoute(initialCategory: SettingsCategories.accounts).push(context); + const SettingsRoute(initialCategory: SettingsCategories.accounts).push(context); }, ), ], diff --git a/packages/neon/neon/lib/src/widgets/app_bar.dart b/packages/neon/neon/lib/src/widgets/app_bar.dart index 99a8e5b1..25408ba7 100644 --- a/packages/neon/neon/lib/src/widgets/app_bar.dart +++ b/packages/neon/neon/lib/src/widgets/app_bar.dart @@ -231,7 +231,7 @@ class _NotificationIconButtonState extends State { ); await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => Provider( create: (final context) => app.getBloc(_account), child: page, diff --git a/packages/neon/neon/test/result_test.dart b/packages/neon/neon/test/result_test.dart index 58be8639..55aee147 100644 --- a/packages/neon/neon/test/result_test.dart +++ b/packages/neon/neon/test/result_test.dart @@ -1,3 +1,5 @@ +// ignore_for_file: inference_failure_on_instance_creation + import 'package:neon/blocs.dart'; import 'package:test/test.dart'; diff --git a/packages/neon/neon/test/settings_export_test.dart b/packages/neon/neon/test/settings_export_test.dart index 6540b559..83fb68ac 100644 --- a/packages/neon/neon/test/settings_export_test.dart +++ b/packages/neon/neon/test/settings_export_test.dart @@ -1,4 +1,4 @@ -// ignore_for_file: avoid_implementing_value_types +// ignore_for_file: avoid_implementing_value_types, inference_failure_on_collection_literal import 'dart:convert'; import 'dart:typed_data'; diff --git a/packages/neon/neon/test/stream_listenable_test.dart b/packages/neon/neon/test/stream_listenable_test.dart index 7ae1d841..4b6294f7 100644 --- a/packages/neon/neon/test/stream_listenable_test.dart +++ b/packages/neon/neon/test/stream_listenable_test.dart @@ -1,4 +1,4 @@ -// ignore_for_file: unreachable_from_main +// ignore_for_file: unreachable_from_main, inference_failure_on_instance_creation import 'dart:async'; diff --git a/packages/neon/neon/test/timer_bloc_test.dart b/packages/neon/neon/test/timer_bloc_test.dart index 5fb69cb6..1d8a0c48 100644 --- a/packages/neon/neon/test/timer_bloc_test.dart +++ b/packages/neon/neon/test/timer_bloc_test.dart @@ -1,3 +1,5 @@ +// ignore_for_file: inference_failure_on_instance_creation + import 'package:neon/blocs.dart'; import 'package:test/test.dart'; diff --git a/packages/neon/neon_files/lib/dialogs/choose_folder.dart b/packages/neon/neon_files/lib/dialogs/choose_folder.dart index 16b37295..6cd02462 100644 --- a/packages/neon/neon_files/lib/dialogs/choose_folder.dart +++ b/packages/neon/neon_files/lib/dialogs/choose_folder.dart @@ -49,7 +49,7 @@ class FilesChooseFolderDialog extends StatelessWidget { child: Text(AppLocalizations.of(context).folderCreate), ), ElevatedButton( - onPressed: !(const ListEquality().equals(originalPath, pathSnapshot.data)) + onPressed: !(const ListEquality().equals(originalPath, pathSnapshot.data)) ? () => Navigator.of(context).pop(pathSnapshot.data) : null, child: Text(AppLocalizations.of(context).folderChoose), diff --git a/packages/neon/neon_files/lib/pages/main.dart b/packages/neon/neon_files/lib/pages/main.dart index 862375b0..1dad7796 100644 --- a/packages/neon/neon_files/lib/pages/main.dart +++ b/packages/neon/neon_files/lib/pages/main.dart @@ -30,7 +30,7 @@ class _FilesMainPageState extends State { ), floatingActionButton: FloatingActionButton( onPressed: () async { - await showDialog( + await showDialog( context: context, builder: (final context) => FilesChooseCreateDialog( bloc: bloc, diff --git a/packages/neon/neon_files/lib/utils/task.dart b/packages/neon/neon_files/lib/utils/task.dart index 1a302eeb..59da283d 100644 --- a/packages/neon/neon_files/lib/utils/task.dart +++ b/packages/neon/neon_files/lib/utils/task.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unnecessary_lambdas + part of '../neon_files.dart'; sealed class FilesTask { diff --git a/packages/neon/neon_files/lib/widgets/actions.dart b/packages/neon/neon_files/lib/widgets/actions.dart index 73e6646d..c0612de4 100644 --- a/packages/neon/neon_files/lib/widgets/actions.dart +++ b/packages/neon/neon_files/lib/widgets/actions.dart @@ -24,7 +24,7 @@ class FileActions extends StatelessWidget { } case FilesFileAction.details: await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => FilesDetailsPage( bloc: bloc, details: details, diff --git a/packages/neon/neon_files/lib/widgets/browser_view.dart b/packages/neon/neon_files/lib/widgets/browser_view.dart index 3f2e4d4f..f1f6d140 100644 --- a/packages/neon/neon_files/lib/widgets/browser_view.dart +++ b/packages/neon/neon_files/lib/widgets/browser_view.dart @@ -177,7 +177,7 @@ class _FilesBrowserViewState extends State { ), ); - bool _pathMatchesFile(final List path, final String name) => const ListEquality().equals( + bool _pathMatchesFile(final List path, final String name) => const ListEquality().equals( [...widget.bloc.path.value, name], path, ); diff --git a/packages/neon/neon_news/lib/widgets/articles_view.dart b/packages/neon/neon_news/lib/widgets/articles_view.dart index 1a5fab1e..f14bad91 100644 --- a/packages/neon/neon_news/lib/widgets/articles_view.dart +++ b/packages/neon/neon_news/lib/widgets/articles_view.dart @@ -188,7 +188,7 @@ class _NewsArticlesViewState extends State { if ((viewType == ArticleViewType.direct || article.url == null) && bodyData != null) { await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => NewsArticlePage( bloc: NewsArticleBloc( widget.bloc, @@ -205,7 +205,7 @@ class _NewsArticlesViewState extends State { article.url != null && NeonPlatform.instance.canUseWebView) { await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => NewsArticlePage( bloc: NewsArticleBloc( widget.bloc, diff --git a/packages/neon/neon_news/lib/widgets/feeds_view.dart b/packages/neon/neon_news/lib/widgets/feeds_view.dart index 107c3ffe..9207cd40 100644 --- a/packages/neon/neon_news/lib/widgets/feeds_view.dart +++ b/packages/neon/neon_news/lib/widgets/feeds_view.dart @@ -64,7 +64,7 @@ class NewsFeedsView extends StatelessWidget { if (feed.updateErrorCount > 0) ...[ IconButton( onPressed: () async { - await showDialog( + await showDialog( context: context, builder: (final context) => NewsFeedUpdateErrorDialog( feed: feed, @@ -105,7 +105,7 @@ class NewsFeedsView extends StatelessWidget { onSelected: (final action) async { switch (action) { case NewsFeedAction.showURL: - await showDialog( + await showDialog( context: context, builder: (final context) => NewsFeedShowURLDialog( feed: feed, @@ -159,7 +159,7 @@ class NewsFeedsView extends StatelessWidget { }, onTap: () async { await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => NewsFeedPage( bloc: bloc, feed: feed, diff --git a/packages/neon/neon_news/lib/widgets/folders_view.dart b/packages/neon/neon_news/lib/widgets/folders_view.dart index b85a76ff..661fef13 100644 --- a/packages/neon/neon_news/lib/widgets/folders_view.dart +++ b/packages/neon/neon_news/lib/widgets/folders_view.dart @@ -114,7 +114,7 @@ class NewsFoldersView extends StatelessWidget { }, onTap: () async { await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => NewsFolderPage( bloc: bloc, folder: folder, diff --git a/packages/neon/neon_notes/lib/widgets/categories_view.dart b/packages/neon/neon_notes/lib/widgets/categories_view.dart index 2c1a741b..aaec773e 100644 --- a/packages/neon/neon_notes/lib/widgets/categories_view.dart +++ b/packages/neon/neon_notes/lib/widgets/categories_view.dart @@ -52,7 +52,7 @@ class NotesCategoriesView extends StatelessWidget { : const SizedBox.square(dimension: largeIconSize), onTap: () async { await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => NotesCategoryPage( bloc: bloc, category: category, diff --git a/packages/neon/neon_notes/lib/widgets/category_select.dart b/packages/neon/neon_notes/lib/widgets/category_select.dart index d153f6a3..2e9a5201 100644 --- a/packages/neon/neon_notes/lib/widgets/category_select.dart +++ b/packages/neon/neon_notes/lib/widgets/category_select.dart @@ -21,7 +21,7 @@ class NotesCategorySelect extends StatelessWidget { final List categories; final String? initialValue; - final Function(String category) onChanged; + final ValueChanged onChanged; final VoidCallback onSubmitted; @override diff --git a/packages/neon/neon_notes/lib/widgets/notes_view.dart b/packages/neon/neon_notes/lib/widgets/notes_view.dart index ecebf9bf..7d68c985 100644 --- a/packages/neon/neon_notes/lib/widgets/notes_view.dart +++ b/packages/neon/neon_notes/lib/widgets/notes_view.dart @@ -76,7 +76,7 @@ class NotesView extends StatelessWidget { ), onTap: () async { await Navigator.of(context).push( - MaterialPageRoute( + MaterialPageRoute( builder: (final context) => NotesNotePage( bloc: NotesNoteBloc( bloc, diff --git a/packages/neon/neon_notifications/lib/pages/main.dart b/packages/neon/neon_notifications/lib/pages/main.dart index e747d60c..84add132 100644 --- a/packages/neon/neon_notifications/lib/pages/main.dart +++ b/packages/neon/neon_notifications/lib/pages/main.dart @@ -95,7 +95,7 @@ class _NotificationsMainPageState extends State { } else { final colorScheme = Theme.of(context).colorScheme; - await showDialog( + await showDialog( context: context, builder: (final context) => AlertDialog( title: Text(AppLocalizations.of(context).notificationAppNotImplementedYet), diff --git a/packages/neon_lints/lib/src/base.yaml b/packages/neon_lints/lib/src/base.yaml index b048b60f..7aaf5fe9 100644 --- a/packages/neon_lints/lib/src/base.yaml +++ b/packages/neon_lints/lib/src/base.yaml @@ -1,6 +1,7 @@ analyzer: language: strict-casts: true + strict-inference: true strict-raw-types: true errors: flutter_style_todos: ignore diff --git a/packages/neon_lints/lint_maker.yaml b/packages/neon_lints/lint_maker.yaml index a25a9e09..d5c441e6 100644 --- a/packages/neon_lints/lint_maker.yaml +++ b/packages/neon_lints/lint_maker.yaml @@ -19,6 +19,7 @@ dart: analyzer: language: strict-casts: true + strict-inference: true strict-raw-types: true errors: flutter_style_todos: ignore diff --git a/packages/nextcloud/lib/src/api/dashboard.openapi.dart b/packages/nextcloud/lib/src/api/dashboard.openapi.dart index c340eba8..b85761c1 100644 --- a/packages/nextcloud/lib/src/api/dashboard.openapi.dart +++ b/packages/nextcloud/lib/src/api/dashboard.openapi.dart @@ -120,7 +120,7 @@ class DashboardDashboardApiClient { Future getWidgetItems({ final ContentString>? sinceIds, final int limit = 7, - final List widgets = const [], + final List widgets = const [], final String oCSAPIRequest = 'true', }) async { const path = '/ocs/v2.php/apps/dashboard/api/v1/widget-items'; @@ -153,7 +153,7 @@ class DashboardDashboardApiClient { if (limit != 7) { queryParameters['limit'] = limit.toString(); } - if (widgets != const []) { + if (widgets != const []) { queryParameters['widgets[]'] = widgets.map((final e) => e); } headers['OCS-APIRequest'] = oCSAPIRequest; @@ -176,7 +176,7 @@ class DashboardDashboardApiClient { Future getWidgetItemsV2({ final ContentString>? sinceIds, final int limit = 7, - final List widgets = const [], + final List widgets = const [], final String oCSAPIRequest = 'true', }) async { const path = '/ocs/v2.php/apps/dashboard/api/v2/widget-items'; @@ -209,7 +209,7 @@ class DashboardDashboardApiClient { if (limit != 7) { queryParameters['limit'] = limit.toString(); } - if (widgets != const []) { + if (widgets != const []) { queryParameters['widgets[]'] = widgets.map((final e) => e); } headers['OCS-APIRequest'] = oCSAPIRequest; diff --git a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart index 1c398d3b..5c0efa50 100644 --- a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart +++ b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart @@ -1185,8 +1185,8 @@ class ProvisioningApiUsersClient { final String password = '', final String displayName = '', final String email = '', - final List groups = const [], - final List subadmin = const [], + final List groups = const [], + final List subadmin = const [], final String quota = '', final String language = '', final String? manager, @@ -1221,10 +1221,10 @@ class ProvisioningApiUsersClient { if (email != '') { queryParameters['email'] = email; } - if (groups != const []) { + if (groups != const []) { queryParameters['groups[]'] = groups.map((final e) => e); } - if (subadmin != const []) { + if (subadmin != const []) { queryParameters['subadmin[]'] = subadmin.map((final e) => e); } if (quota != '') { diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index e045f0dc..a254d427 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -160,7 +160,7 @@ class WebDavClient { final DateTime? lastModified, final DateTime? created, final int? contentLength, - final Function(double progres)? onProgress, + final void Function(double progres)? onProgress, }) async { var uploaded = 0; return _send( @@ -193,7 +193,7 @@ class WebDavClient { final Uri path, { final DateTime? lastModified, final DateTime? created, - final Function(double progres)? onProgress, + final void Function(double progres)? onProgress, }) async => putStream( file.openRead().cast(), @@ -217,12 +217,12 @@ class WebDavClient { Future getFile( final Uri path, final File file, { - final Function(double progress)? onProgress, + final void Function(double progress)? onProgress, }) async { final sink = file.openWrite(); final response = await getStream(path); if (response.contentLength > 0) { - final completer = Completer(); + final completer = Completer(); var downloaded = 0; response.listen((final chunk) async { diff --git a/packages/nextcloud/test/helper.dart b/packages/nextcloud/test/helper.dart index 47d104a3..db2e0dd8 100644 --- a/packages/nextcloud/test/helper.dart +++ b/packages/nextcloud/test/helper.dart @@ -1,3 +1,5 @@ +// ignore_for_file: inference_failure_on_instance_creation + import 'dart:async'; import 'dart:convert'; import 'dart:io';