mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-30 00:36:28 +00:00
46 lines
1.0 KiB
Dart
46 lines
1.0 KiB
Dart
import 'package:meta/meta.dart';
|
|
|
|
/// Application configuration model
|
|
///
|
|
/// @author Pierre HUBERT
|
|
|
|
/// Configuration class
|
|
class Config {
|
|
final String apiServerName;
|
|
final String apiServerUri;
|
|
final bool apiServerSecure;
|
|
final String serviceName;
|
|
final String serviceToken;
|
|
final String termsOfServicesURL;
|
|
|
|
const Config({
|
|
@required this.apiServerName,
|
|
@required this.apiServerUri,
|
|
@required this.apiServerSecure,
|
|
@required this.serviceName,
|
|
@required this.serviceToken,
|
|
@required this.termsOfServicesURL,
|
|
}) : assert(apiServerName != null),
|
|
assert(apiServerUri != null),
|
|
assert(apiServerSecure != null),
|
|
assert(serviceName != null),
|
|
assert(serviceToken != null),
|
|
assert(termsOfServicesURL != null);
|
|
|
|
/// Get and set static configuration
|
|
static Config _config;
|
|
|
|
static Config get() {
|
|
return _config;
|
|
}
|
|
|
|
static void set(Config conf) {
|
|
_config = conf;
|
|
}
|
|
}
|
|
|
|
/// Get the current configuration of the application
|
|
Config config() {
|
|
return Config.get();
|
|
}
|