2019-04-22 17:16:26 +00:00
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
|
|
|
|
/// Application configuration model
|
|
|
|
///
|
|
|
|
/// @author Pierre HUBERT
|
|
|
|
|
|
|
|
/// Configuration class
|
|
|
|
class Config {
|
|
|
|
final String apiServerName;
|
|
|
|
final String apiServerUri;
|
|
|
|
final bool apiServerSecure;
|
2021-02-13 15:03:07 +00:00
|
|
|
final String clientName;
|
|
|
|
|
2019-11-02 17:54:30 +00:00
|
|
|
final String termsOfServicesURL;
|
2019-04-22 17:16:26 +00:00
|
|
|
|
2019-11-02 17:16:16 +00:00
|
|
|
const Config({
|
|
|
|
@required this.apiServerName,
|
|
|
|
@required this.apiServerUri,
|
|
|
|
@required this.apiServerSecure,
|
2021-02-13 15:03:07 +00:00
|
|
|
@required this.clientName,
|
2019-11-02 17:54:30 +00:00
|
|
|
@required this.termsOfServicesURL,
|
2019-11-02 17:16:16 +00:00
|
|
|
}) : assert(apiServerName != null),
|
2019-04-22 17:16:26 +00:00
|
|
|
assert(apiServerUri != null),
|
|
|
|
assert(apiServerSecure != null),
|
2021-02-13 15:03:07 +00:00
|
|
|
assert(clientName != null),
|
2019-11-02 17:54:30 +00:00
|
|
|
assert(termsOfServicesURL != null);
|
2019-04-22 17:16:26 +00:00
|
|
|
|
|
|
|
/// 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();
|
|
|
|
}
|