Skip to content

Commit f22dd48

Browse files
author
ekjotmultani
committed
made bucket_output class a proper output class like the others in amplify-flutter
1 parent c5c0438 commit f22dd48

File tree

6 files changed

+77
-23
lines changed

6 files changed

+77
-23
lines changed

packages/amplify_core/doc/lib/auth.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ Future<void> _handleSignInResult(SignInResult result) async {
110110
// #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code
111111
// #docregion handle-confirm-signin-mfa-selection
112112
case AuthSignInStep.continueSignInWithMfaSelection:
113-
final allowedMfaTypes = result.nextStep.allowedMfaTypes!;
113+
final allowedMfaTypes = result.nextStep.allowedMfaTypes;
114114
final selection = await _promptUserPreference(allowedMfaTypes);
115115
return _handleMfaSelection(selection);
116116
// #enddocregion handle-confirm-signin-mfa-selection
117117
// #docregion handle-confirm-signin-totp-setup
118118
case AuthSignInStep.continueSignInWithTotpSetup:
119-
final totpSetupDetails = result.nextStep.totpSetupDetails!;
119+
final totpSetupDetails = result.nextStep.totpSetupDetails;
120120
final setupUri = totpSetupDetails.getSetupUri(appName: 'MyApp');
121121
safePrint('Open URI to complete setup: $setupUri');
122122
// #enddocregion handle-confirm-signin-totp-setup
@@ -255,7 +255,7 @@ Future<void> signOutGlobally() async {
255255
if (result is CognitoCompleteSignOut) {
256256
safePrint('Sign out completed successfully');
257257
} else if (result is CognitoPartialSignOut) {
258-
final globalSignOutException = result.globalSignOutException!;
258+
final globalSignOutException = result.globalSignOutException;
259259
final accessToken = globalSignOutException.accessToken;
260260
// Retry the global sign out using the access token, if desired
261261
// ...
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
import 'package:amplify_core/amplify_core.dart';
5+
6+
part 'bucket_output.g.dart';
7+
8+
@zAmplifyOutputsSerializable
9+
class BucketOutput
10+
with AWSEquatable<BucketOutput>, AWSSerializable, AWSDebuggable{
11+
12+
const BucketOutput({required this.name, required this.bucketName, required this.awsRegion});
13+
14+
factory BucketOutput.fromJson(Map<String, Object?> json) =>
15+
_$BucketOutputFromJson(json);
16+
17+
final String name;
18+
19+
final String bucketName;
20+
21+
final String awsRegion;
22+
23+
@override
24+
List<Object?> get props => [
25+
name,
26+
bucketName,
27+
awsRegion,
28+
];
29+
30+
@override
31+
String get runtimeTypeName => 'BucketOutput';
32+
33+
@override
34+
Object? toJson() {
35+
return _$BucketOutputToJson(this);
36+
}
37+
}

packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
import 'package:amplify_core/amplify_core.dart';
5-
import 'package:amplify_core/src/config/amplify_outputs/storage/storage_output_bucket.dart';
5+
import 'package:amplify_core/src/config/amplify_outputs/storage/bucket_output.dart';
66

77
part 'storage_outputs.g.dart';
88

@@ -26,7 +26,7 @@ class StorageOutputs
2626
final String bucketName;
2727

2828
/// The list of buckets if there are multiple buckets for the project
29-
final List<StorageOutputBucket>? buckets;
29+
final List<BucketOutput>? buckets;
3030

3131
@override
3232
List<Object?> get props => [awsRegion, bucketName, buckets];

packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)