-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathconfig.dart
More file actions
45 lines (38 loc) · 1.09 KB
/
config.dart
File metadata and controls
45 lines (38 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'package:aws_client/polly_2016_06_10.dart' show AwsClientCredentials;
///Holds all configurations
class ConfigAmazon {
static late final String _keyId;
static late final String _accessKey;
static late final String _region;
ConfigAmazon._();
static void init(
{required String keyId,
required String accessKey,
required String region}) {
_keyId = keyId;
_accessKey = accessKey;
_region = region;
}
static String get keyId {
if (ConfigAmazon._keyId.isEmpty) {
throw Exception("Amazon Key ID is not initialized");
}
return ConfigAmazon._keyId;
}
static String get accessKey {
if (ConfigAmazon._accessKey.isEmpty) {
throw Exception("Amazon Access Key is not initialized");
}
return ConfigAmazon._accessKey;
}
static String get region {
if (ConfigAmazon._region.isEmpty) {
throw Exception("Amazon Region is not initialized");
}
return ConfigAmazon._region;
}
static AwsClientCredentials get credentials => AwsClientCredentials(
accessKey: keyId,
secretKey: accessKey,
);
}