mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
31 lines
700 B
Dart
31 lines
700 B
Dart
import 'package:toolbox/data/model/container/type.dart';
|
|
|
|
import '../../core/persistant_store.dart';
|
|
|
|
const _keyConfig = 'providerConfig';
|
|
|
|
class DockerStore extends PersistentStore {
|
|
DockerStore() : super('docker');
|
|
|
|
String? fetch(String? id) {
|
|
return box.get(id);
|
|
}
|
|
|
|
void put(String id, String host) {
|
|
box.put(id, host);
|
|
}
|
|
|
|
ContainerType getType([String? id]) {
|
|
final cfg = box.get(_keyConfig + (id ?? ''));
|
|
if (cfg == null) {
|
|
return ContainerType.docker;
|
|
} else {
|
|
return ContainerType.values.firstWhere((e) => e.toString() == cfg);
|
|
}
|
|
}
|
|
|
|
void setType(String? id, ContainerType type) {
|
|
box.put(_keyConfig + (id ?? ''), type.toString());
|
|
}
|
|
}
|