mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: podman
This commit is contained in:
30
lib/data/store/container.dart
Normal file
30
lib/data/store/container.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user