From a413ab2934503983430d1411951b3dac265c43d7 Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Mon, 13 Jan 2025 09:10:53 -0800 Subject: [PATCH] chore(core,datastore,authenticator,common): fixed linter warnings --- .../src/types/auth/attribute/auth_user_attribute_key.dart | 1 - .../src/types/auth/attribute/cognito_user_attribute_key.dart | 1 - .../amplify_datastore/lib/src/utils/native_api_helpers.dart | 2 +- .../lib/src/graphql/factories/graphql_request_factory.dart | 5 ----- .../amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart | 2 -- .../lib/src/widgets/form_fields/sign_in_form_field.dart | 2 -- packages/aws_common/lib/src/http/aws_http_client_js.dart | 3 +-- 7 files changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/amplify_core/lib/src/types/auth/attribute/auth_user_attribute_key.dart b/packages/amplify_core/lib/src/types/auth/attribute/auth_user_attribute_key.dart index a17900049e..04064286cf 100644 --- a/packages/amplify_core/lib/src/types/auth/attribute/auth_user_attribute_key.dart +++ b/packages/amplify_core/lib/src/types/auth/attribute/auth_user_attribute_key.dart @@ -9,7 +9,6 @@ import 'package:meta/meta.dart'; /// {@template amplify_core.auth_user_attribute_key} /// A user attribute identifier. /// {@endtemplate} -/// {@hideConstantImplementations} @immutable abstract class AuthUserAttributeKey with diff --git a/packages/amplify_core/lib/src/types/auth/attribute/cognito_user_attribute_key.dart b/packages/amplify_core/lib/src/types/auth/attribute/cognito_user_attribute_key.dart index 21e4867dae..ebda0d423c 100644 --- a/packages/amplify_core/lib/src/types/auth/attribute/cognito_user_attribute_key.dart +++ b/packages/amplify_core/lib/src/types/auth/attribute/cognito_user_attribute_key.dart @@ -12,7 +12,6 @@ import 'package:amplify_core/amplify_core.dart'; /// [here](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html). /// /// Use [CognitoUserAttributeKey.custom] to create a custom Cognito attribute. -/// {@hideConstantImplementations} class CognitoUserAttributeKey extends AuthUserAttributeKey { const CognitoUserAttributeKey._(this._key, {this.readOnly = false}) : isCustom = false; diff --git a/packages/amplify_datastore/lib/src/utils/native_api_helpers.dart b/packages/amplify_datastore/lib/src/utils/native_api_helpers.dart index b59aceb856..f6f70ea050 100644 --- a/packages/amplify_datastore/lib/src/utils/native_api_helpers.dart +++ b/packages/amplify_datastore/lib/src/utils/native_api_helpers.dart @@ -85,7 +85,7 @@ NativeGraphQLResponse graphQLResponseToNativeResponse( /// from a [GraphQLResponse] String _buildPayloadJson(GraphQLResponse response) { final data = jsonDecode(response.data ?? '{}'); - final errors = response.errors.whereNotNull().map((e) => e.toJson()).toList(); + final errors = response.errors.nonNulls.map((e) => e.toJson()).toList(); return jsonEncode({ 'data': data, 'errors': errors, diff --git a/packages/api/amplify_api_dart/lib/src/graphql/factories/graphql_request_factory.dart b/packages/api/amplify_api_dart/lib/src/graphql/factories/graphql_request_factory.dart index 36ac085546..e5ce1b6ba2 100644 --- a/packages/api/amplify_api_dart/lib/src/graphql/factories/graphql_request_factory.dart +++ b/packages/api/amplify_api_dart/lib/src/graphql/factories/graphql_request_factory.dart @@ -176,11 +176,6 @@ class GraphQLRequestFactory { upperOutput = '(\$filter: ModelSubscription${modelName}FilterInput)'; lowerOutput = r'(filter: $filter)'; } - default: - throw const ApiOperationException( - 'GraphQL Request Operation is currently unsupported', - recoverySuggestion: 'please use a supported GraphQL operation', - ); } return DocumentInputs(upperOutput, lowerOutput); diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index 5604f7bd21..518957e292 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -261,8 +261,6 @@ class StateMachineBloc } } yield* _checkUserVerification(); - default: - break; } } on AuthNotAuthorizedException { /// The .failAuthentication flag available in the DefineAuthChallenge Lambda trigger diff --git a/packages/authenticator/amplify_authenticator/lib/src/widgets/form_fields/sign_in_form_field.dart b/packages/authenticator/amplify_authenticator/lib/src/widgets/form_fields/sign_in_form_field.dart index d65618fa04..f7f941dbcf 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/widgets/form_fields/sign_in_form_field.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/widgets/form_fields/sign_in_form_field.dart @@ -159,8 +159,6 @@ class _SignInTextFieldState extends _SignInFormFieldState return (v) => state.username = v; case SignInField.password: return (v) => state.password = v; - default: - return super.onChanged; } } diff --git a/packages/aws_common/lib/src/http/aws_http_client_js.dart b/packages/aws_common/lib/src/http/aws_http_client_js.dart index e2f444177f..9a4da6375e 100644 --- a/packages/aws_common/lib/src/http/aws_http_client_js.dart +++ b/packages/aws_common/lib/src/http/aws_http_client_js.dart @@ -71,8 +71,7 @@ class AWSHttpClientImpl extends AWSHttpClient { requestProgressController.close(); }, ).takeUntil(cancelTrigger.future); - Object body; - body = Uint8List.fromList(await collectBytes(stream)); + Object body = Uint8List.fromList(await collectBytes(stream)); if (completer.isCanceled) return; final resp = await fetch(