From e2ba362baf6f0381dfc658666f2cde1121bded1a Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 17 Aug 2023 08:35:19 +0200 Subject: [PATCH] chore(dynamite,neon,neon_files,neon_news,nextcloud): Fix linter complaints Signed-off-by: jld3103 --- .../dynamite/lib/src/openapi_builder.dart | 4 +-- .../test/content_string_test.dart | 34 +++++++++---------- packages/neon/neon/lib/src/pages/home.dart | 4 ++- .../neon/neon/lib/src/pages/settings.dart | 10 ++++-- packages/neon/neon/lib/src/router.dart | 2 +- .../lib/src/widgets/account_switcher.dart | 2 +- .../neon/lib/src/widgets/image_wrapper.dart | 2 +- .../neon/neon_files/lib/widgets/actions.dart | 15 ++++++++ .../lib/widgets/file_list_tile.dart | 2 +- .../neon_news/lib/widgets/feeds_view.dart | 9 +++++ .../neon_news/lib/widgets/folders_view.dart | 3 ++ .../nextcloud/lib/src/api/core.openapi.dart | 4 +-- .../lib/src/api/files_sharing.openapi.dart | 6 ++-- .../lib/src/api/provisioning_api.openapi.dart | 28 +++++++-------- .../lib/src/api/settings.openapi.dart | 2 +- .../lib/src/api/user_status.openapi.dart | 2 +- 16 files changed, 81 insertions(+), 48 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index fc541c86..1d88b1f1 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -1113,7 +1113,7 @@ TypeResult resolveObject( ..type = refer('String') ..annotations.add(refer('override')) ..assignment = Code("r'${state.prefix}$identifier'"), - ) + ), ]) ..methods.addAll([ Method((final b) { @@ -1389,7 +1389,7 @@ TypeResult resolveType( ..type = refer('String') ..annotations.add(refer('override')) ..assignment = Code("r'${state.prefix}$identifier'"), - ) + ), ]) ..methods.addAll([ Method((final b) { diff --git a/packages/dynamite/dynamite_runtime/test/content_string_test.dart b/packages/dynamite/dynamite_runtime/test/content_string_test.dart index f9c88d0f..331e98dd 100644 --- a/packages/dynamite/dynamite_runtime/test/content_string_test.dart +++ b/packages/dynamite/dynamite_runtime/test/content_string_test.dart @@ -20,14 +20,14 @@ final Serializers serializers = (_$serializers.toBuilder() ..addBuilderFactory(const FullType(ContentString, [FullType(double)]), ContentStringBuilder.new) ..addBuilderFactory( const FullType(ContentString, [ - FullType(BuiltList, [FullType(int)]) + FullType(BuiltList, [FullType(int)]), ]), ContentStringBuilder>.new, ) ..addBuilderFactory(const FullType(BuiltList, [FullType(int)]), ListBuilder.new) ..addBuilderFactory( const FullType(ContentString, [ - FullType(BuiltMap, [FullType(String), FullType(int)]) + FullType(BuiltMap, [FullType(String), FullType(int)]), ]), ContentStringBuilder>.new, ) @@ -36,7 +36,7 @@ final Serializers serializers = (_$serializers.toBuilder() ..addBuilderFactory(const FullType(ContentString, [FullType(String)]), ContentStringBuilder.new) ..addBuilderFactory( const FullType(ContentString, [ - FullType(ContentString, [FullType(String)]) + FullType(ContentString, [FullType(String)]), ]), ContentStringBuilder>.new, )) @@ -62,7 +62,7 @@ void main() { final serialized = json.decode( json.encode({ r'$': 'ContentString', - 'content': {r'$': 'bool', '': true} + 'content': {r'$': 'bool', '': true}, }), ) as Object; const specifiedType = FullType.unspecified; @@ -95,7 +95,7 @@ void main() { final serialized = json.decode( json.encode({ r'$': 'ContentString', - 'content': {r'$': 'double', '': 42.5} + 'content': {r'$': 'double', '': 42.5}, }), ) as Object; const specifiedType = FullType.unspecified; @@ -113,7 +113,7 @@ void main() { final data = ContentString>((final b) => b..content = BuiltList([1, 2, 3])); final serialized = json.encode([1, 2, 3]); const specifiedType = FullType(ContentString, [ - FullType(BuiltList, [FullType(int)]) + FullType(BuiltList, [FullType(int)]), ]); test('can be serialized', () { @@ -135,9 +135,9 @@ void main() { '': [ {r'$': 'int', '': 1}, {r'$': 'int', '': 2}, - {r'$': 'int', '': 3} - ] - } + {r'$': 'int', '': 3}, + ], + }, }), ) as Object; const specifiedType = FullType.unspecified; @@ -158,7 +158,7 @@ void main() { // using the StandardJsonPlugin will encode it to a valid Map. final serialized = json.encode({'one': 1, 'two': 2, 'three': 3}); const specifiedType = FullType(ContentString, [ - FullType(BuiltMap, [FullType(String), FullType(int)]) + FullType(BuiltMap, [FullType(String), FullType(int)]), ]); test('can be serialized', () { @@ -179,8 +179,8 @@ void main() { r'$': 'encoded_map', r'{"$":"String","":"one"}': {r'$': 'int', '': 1}, r'{"$":"String","":"two"}': {r'$': 'int', '': 2}, - r'{"$":"String","":"three"}': {r'$': 'int', '': 3} - } + r'{"$":"String","":"three"}': {r'$': 'int', '': 3}, + }, }), ) as Object; const specifiedType = FullType.unspecified; @@ -216,7 +216,7 @@ void main() { final serialized = json.decode( json.encode({ r'$': 'ContentString', - 'content': {r'$': 'int', '': 42} + 'content': {r'$': 'int', '': 42}, }), ) as Object; const specifiedType = FullType.unspecified; @@ -249,7 +249,7 @@ void main() { final serialized = json.decode( json.encode({ r'$': 'ContentString', - 'content': {r'$': 'String', '': 'test'} + 'content': {r'$': 'String', '': 'test'}, }), ) as Object; const specifiedType = FullType.unspecified; @@ -272,7 +272,7 @@ void main() { ); final serialized = json.encode(json.encode('test')); const specifiedType = FullType(ContentString, [ - FullType(ContentString, [FullType(String)]) + FullType(ContentString, [FullType(String)]), ]); test('can be serialized', () { @@ -296,8 +296,8 @@ void main() { r'$': 'ContentString', 'content': { r'$': 'ContentString', - 'content': {r'$': 'String', '': 'test'} - } + 'content': {r'$': 'String', '': 'test'}, + }, }), ) as Object; const specifiedType = FullType.unspecified; diff --git a/packages/neon/neon/lib/src/pages/home.dart b/packages/neon/neon/lib/src/pages/home.dart index f0792c17..6db33cc4 100644 --- a/packages/neon/neon/lib/src/pages/home.dart +++ b/packages/neon/neon/lib/src/pages/home.dart @@ -89,7 +89,9 @@ class _HomePageState extends State { } catch (e, s) { debugPrint(e.toString()); debugPrint(s.toString()); - NeonException.showSnackbar(context, e); + if (mounted) { + NeonException.showSnackbar(context, e); + } } } diff --git a/packages/neon/neon/lib/src/pages/settings.dart b/packages/neon/neon/lib/src/pages/settings.dart index 5065abc5..8baf90f7 100644 --- a/packages/neon/neon/lib/src/pages/settings.dart +++ b/packages/neon/neon/lib/src/pages/settings.dart @@ -217,7 +217,7 @@ class _SettingsPageState extends State { icon: Icon(MdiIcons.accountPlus), label: Text(AppLocalizations.of(context).globalOptionsAccountsAdd), ), - ) + ), ], ), SettingsCategory( @@ -264,7 +264,9 @@ class _SettingsPageState extends State { } catch (e, s) { debugPrint(e.toString()); debugPrint(s.toString()); - NeonException.showSnackbar(context, e); + if (mounted) { + NeonException.showSnackbar(context, e); + } } }, ), @@ -302,7 +304,9 @@ class _SettingsPageState extends State { } catch (e, s) { debugPrint(e.toString()); debugPrint(s.toString()); - NeonException.showSnackbar(context, e); + if (mounted) { + NeonException.showSnackbar(context, e); + } } }, ), diff --git a/packages/neon/neon/lib/src/router.dart b/packages/neon/neon/lib/src/router.dart index 509e8f5d..8db0007f 100644 --- a/packages/neon/neon/lib/src/router.dart +++ b/packages/neon/neon/lib/src/router.dart @@ -109,7 +109,7 @@ class AccountSettingsRoute extends GoRouteData { name: 'AccountSettings', ), ], - ) + ), ], ) @immutable diff --git a/packages/neon/neon/lib/src/widgets/account_switcher.dart b/packages/neon/neon/lib/src/widgets/account_switcher.dart index 869c60de..539218ee 100644 --- a/packages/neon/neon/lib/src/widgets/account_switcher.dart +++ b/packages/neon/neon/lib/src/widgets/account_switcher.dart @@ -59,7 +59,7 @@ class AccountSwitcherButton extends StatelessWidget { Navigator.of(context).pop(); const SettingsRoute(initialCategory: SettingsCageories.accounts).push(context); }, - ) + ), ], ); diff --git a/packages/neon/neon/lib/src/widgets/image_wrapper.dart b/packages/neon/neon/lib/src/widgets/image_wrapper.dart index f77b967c..e30cfee3 100644 --- a/packages/neon/neon/lib/src/widgets/image_wrapper.dart +++ b/packages/neon/neon/lib/src/widgets/image_wrapper.dart @@ -16,7 +16,7 @@ class NeonImageWrapper extends StatelessWidget { @override Widget build(final BuildContext context) => ClipRRect( - borderRadius: borderRadius, + borderRadius: borderRadius ?? BorderRadius.zero, child: ColorFiltered( colorFilter: ColorFilter.mode(color, BlendMode.dstATop), child: SizedBox.fromSize( diff --git a/packages/neon/neon_files/lib/widgets/actions.dart b/packages/neon/neon_files/lib/widgets/actions.dart index 334228e6..1e39ea41 100644 --- a/packages/neon/neon_files/lib/widgets/actions.dart +++ b/packages/neon/neon_files/lib/widgets/actions.dart @@ -33,6 +33,9 @@ class FileActions extends StatelessWidget { ), ); case FilesFileAction.rename: + if (!context.mounted) { + return; + } final result = await showRenameDialog( context: context, title: @@ -43,6 +46,9 @@ class FileActions extends StatelessWidget { bloc.rename(details.path, result); } case FilesFileAction.move: + if (!context.mounted) { + return; + } final b = bloc.getNewFilesBrowserBloc(); final originalPath = details.path.sublist(0, details.path.length - 1); b.setPath(originalPath); @@ -59,6 +65,9 @@ class FileActions extends StatelessWidget { bloc.move(details.path, result..add(details.name)); } case FilesFileAction.copy: + if (!context.mounted) { + return; + } final b = bloc.getNewFilesBrowserBloc(); final originalPath = details.path.sublist(0, details.path.length - 1); b.setPath(originalPath); @@ -75,6 +84,9 @@ class FileActions extends StatelessWidget { bloc.copy(details.path, result..add(details.name)); } case FilesFileAction.sync: + if (!context.mounted) { + return; + } final sizeWarning = browserBloc.options.downloadSizeWarning.value; if (sizeWarning != null && details.size != null && details.size! > sizeWarning) { if (!(await showConfirmationDialog( @@ -89,6 +101,9 @@ class FileActions extends StatelessWidget { } bloc.syncFile(details.path); case FilesFileAction.delete: + if (!context.mounted) { + return; + } if (await showConfirmationDialog( context, details.isDirectory diff --git a/packages/neon/neon_files/lib/widgets/file_list_tile.dart b/packages/neon/neon_files/lib/widgets/file_list_tile.dart index 9cb70a40..c03db4ee 100644 --- a/packages/neon/neon_files/lib/widgets/file_list_tile.dart +++ b/packages/neon/neon_files/lib/widgets/file_list_tile.dart @@ -122,7 +122,7 @@ class _FileIcon extends StatelessWidget { size: 14, color: Colors.yellow, ), - ) + ), ], ); } diff --git a/packages/neon/neon_news/lib/widgets/feeds_view.dart b/packages/neon/neon_news/lib/widgets/feeds_view.dart index ddebd570..107c3ffe 100644 --- a/packages/neon/neon_news/lib/widgets/feeds_view.dart +++ b/packages/neon/neon_news/lib/widgets/feeds_view.dart @@ -112,6 +112,9 @@ class NewsFeedsView extends StatelessWidget { ), ); case NewsFeedAction.delete: + if (!context.mounted) { + return; + } if (await showConfirmationDialog( context, AppLocalizations.of(context).feedRemoveConfirm(feed.title), @@ -119,6 +122,9 @@ class NewsFeedsView extends StatelessWidget { bloc.removeFeed(feed.id); } case NewsFeedAction.rename: + if (!context.mounted) { + return; + } final result = await showRenameDialog( context: context, title: AppLocalizations.of(context).feedRename, @@ -128,6 +134,9 @@ class NewsFeedsView extends StatelessWidget { bloc.renameFeed(feed.id, result); } case NewsFeedAction.move: + if (!context.mounted) { + return; + } final result = await showDialog>( context: context, builder: (final context) => NewsMoveFeedDialog( diff --git a/packages/neon/neon_news/lib/widgets/folders_view.dart b/packages/neon/neon_news/lib/widgets/folders_view.dart index 5b308663..058f70d0 100644 --- a/packages/neon/neon_news/lib/widgets/folders_view.dart +++ b/packages/neon/neon_news/lib/widgets/folders_view.dart @@ -93,6 +93,9 @@ class NewsFoldersView extends StatelessWidget { bloc.deleteFolder(folder.id); } case NewsFolderAction.rename: + if (!context.mounted) { + return; + } final result = await showRenameDialog( context: context, title: AppLocalizations.of(context).folderRename, diff --git a/packages/nextcloud/lib/src/api/core.openapi.dart b/packages/nextcloud/lib/src/api/core.openapi.dart index c0b0922f..1ca47606 100644 --- a/packages/nextcloud/lib/src/api/core.openapi.dart +++ b/packages/nextcloud/lib/src/api/core.openapi.dart @@ -4138,7 +4138,7 @@ class _$CoreReferenceApiResolveResponse200ApplicationJson_Ocs_Data_ReferencesSer @override final Iterable types = const [ CoreReferenceApiResolveResponse200ApplicationJson_Ocs_Data_References, - _$CoreReferenceApiResolveResponse200ApplicationJson_Ocs_Data_References + _$CoreReferenceApiResolveResponse200ApplicationJson_Ocs_Data_References, ]; @override @@ -4282,7 +4282,7 @@ class _$CoreReferenceApiExtractResponse200ApplicationJson_Ocs_Data_ReferencesSer @override final Iterable types = const [ CoreReferenceApiExtractResponse200ApplicationJson_Ocs_Data_References, - _$CoreReferenceApiExtractResponse200ApplicationJson_Ocs_Data_References + _$CoreReferenceApiExtractResponse200ApplicationJson_Ocs_Data_References, ]; @override diff --git a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart index ba9f4b4c..9a267898 100644 --- a/packages/nextcloud/lib/src/api/files_sharing.openapi.dart +++ b/packages/nextcloud/lib/src/api/files_sharing.openapi.dart @@ -2379,7 +2379,7 @@ class _$FilesSharingShareesapiShareesapiSearchHeadersSerializer @override final Iterable types = const [ FilesSharingShareesapiShareesapiSearchHeaders, - _$FilesSharingShareesapiShareesapiSearchHeaders + _$FilesSharingShareesapiShareesapiSearchHeaders, ]; @override @@ -3455,7 +3455,7 @@ class _$FilesSharingShareesapiFindRecommendedShareTypeSerializer @override final Iterable types = const [ FilesSharingShareesapiFindRecommendedShareType, - _$FilesSharingShareesapiFindRecommendedShareType + _$FilesSharingShareesapiFindRecommendedShareType, ]; @override @@ -4119,7 +4119,7 @@ final Serializers _serializers = (Serializers().toBuilder() ) ..addBuilderFactory( const FullType(BuiltList, [ - FullType(BuiltMap, [FullType(String), FullType(JsonObject)]) + FullType(BuiltMap, [FullType(String), FullType(JsonObject)]), ]), ListBuilder.new, ) diff --git a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart index 42adecb4..77e74e6b 100644 --- a/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart +++ b/packages/nextcloud/lib/src/api/provisioning_api.openapi.dart @@ -1043,7 +1043,7 @@ class ProvisioningApiPreferencesClient { queryParameters['configs'] = _jsonSerializers.serialize( configs, specifiedType: const FullType(ContentString, [ - FullType(BuiltMap, [FullType(String), FullType(String)]) + FullType(BuiltMap, [FullType(String), FullType(String)]), ]), ); path = path.replaceAll('{appId}', Uri.encodeQueryComponent(appId)); @@ -1313,8 +1313,8 @@ class ProvisioningApiUsersClient { specifiedType: const FullType(ContentString, [ FullType(BuiltMap, [ FullType(String), - FullType(BuiltList, [FullType(String)]) - ]) + FullType(BuiltList, [FullType(String)]), + ]), ]), ); headers['OCS-APIRequest'] = oCSAPIRequest; @@ -3349,7 +3349,7 @@ class _$ProvisioningApiGroupsGetGroupUsersDetailsResponse200ApplicationJson_Ocs_ @override final Iterable types = const [ ProvisioningApiGroupsGetGroupUsersDetailsResponse200ApplicationJson_Ocs_Data_Users, - _$ProvisioningApiGroupsGetGroupUsersDetailsResponse200ApplicationJson_Ocs_Data_Users + _$ProvisioningApiGroupsGetGroupUsersDetailsResponse200ApplicationJson_Ocs_Data_Users, ]; @override @@ -4140,7 +4140,7 @@ class _$ProvisioningApiUsersGetUsersDetailsResponse200ApplicationJson_Ocs_Data_U @override final Iterable types = const [ ProvisioningApiUsersGetUsersDetailsResponse200ApplicationJson_Ocs_Data_Users, - _$ProvisioningApiUsersGetUsersDetailsResponse200ApplicationJson_Ocs_Data_Users + _$ProvisioningApiUsersGetUsersDetailsResponse200ApplicationJson_Ocs_Data_Users, ]; @override @@ -5510,7 +5510,7 @@ final Serializers _serializers = (Serializers().toBuilder() ..addBuilderFactory( const FullType(BuiltMap, [ FullType(String), - FullType(ProvisioningApiGroupsGetGroupUsersDetailsResponse200ApplicationJson_Ocs_Data_Users) + FullType(ProvisioningApiGroupsGetGroupUsersDetailsResponse200ApplicationJson_Ocs_Data_Users), ]), MapBuilder.new, ) @@ -5585,7 +5585,7 @@ final Serializers _serializers = (Serializers().toBuilder() ) ..addBuilderFactory( const FullType(ContentString, [ - FullType(BuiltMap, [FullType(String), FullType(String)]) + FullType(BuiltMap, [FullType(String), FullType(String)]), ]), ContentString>.new, ) @@ -5666,16 +5666,16 @@ final Serializers _serializers = (Serializers().toBuilder() ) ..add(ProvisioningApiUsersGetUsersDetailsResponse200ApplicationJson_Ocs_Data_Users1.serializer) ..addBuilderFactory( - const FullType( - BuiltMap, - [FullType(String), FullType(ProvisioningApiUsersGetUsersDetailsResponse200ApplicationJson_Ocs_Data_Users)], - ), + const FullType(BuiltMap, [ + FullType(String), + FullType(ProvisioningApiUsersGetUsersDetailsResponse200ApplicationJson_Ocs_Data_Users), + ]), MapBuilder.new, ) ..addBuilderFactory( const FullType(BuiltMap, [ FullType(String), - FullType(BuiltList, [FullType(String)]) + FullType(BuiltList, [FullType(String)]), ]), MapBuilder.new, ) @@ -5683,8 +5683,8 @@ final Serializers _serializers = (Serializers().toBuilder() const FullType(ContentString, [ FullType(BuiltMap, [ FullType(String), - FullType(BuiltList, [FullType(String)]) - ]) + FullType(BuiltList, [FullType(String)]), + ]), ]), ContentString>>.new, ) diff --git a/packages/nextcloud/lib/src/api/settings.openapi.dart b/packages/nextcloud/lib/src/api/settings.openapi.dart index 3261c3a2..9f11e543 100644 --- a/packages/nextcloud/lib/src/api/settings.openapi.dart +++ b/packages/nextcloud/lib/src/api/settings.openapi.dart @@ -151,7 +151,7 @@ class _$SettingsLogSettingsLogSettingsDownloadHeadersSerializer @override final Iterable types = const [ SettingsLogSettingsLogSettingsDownloadHeaders, - _$SettingsLogSettingsLogSettingsDownloadHeaders + _$SettingsLogSettingsLogSettingsDownloadHeaders, ]; @override diff --git a/packages/nextcloud/lib/src/api/user_status.openapi.dart b/packages/nextcloud/lib/src/api/user_status.openapi.dart index ec34ddb9..f4c458e8 100644 --- a/packages/nextcloud/lib/src/api/user_status.openapi.dart +++ b/packages/nextcloud/lib/src/api/user_status.openapi.dart @@ -1258,7 +1258,7 @@ class _$UserStatusUserStatusRevertStatusResponse200ApplicationJson_Ocs_DataSeria @override final Iterable types = const [ UserStatusUserStatusRevertStatusResponse200ApplicationJson_Ocs_Data, - _$UserStatusUserStatusRevertStatusResponse200ApplicationJson_Ocs_Data + _$UserStatusUserStatusRevertStatusResponse200ApplicationJson_Ocs_Data, ]; @override