modern
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
/// Temporary in-memory store for complex field data (e.g., uploads)
|
||||
/// Keyed by fieldKey. Values are dynamic but expected shapes are documented.
|
||||
class EntityFieldStore {
|
||||
EntityFieldStore._();
|
||||
static final EntityFieldStore instance = EntityFieldStore._();
|
||||
|
||||
final Map<String, dynamic> _data = {};
|
||||
|
||||
void set(String fieldKey, dynamic value) {
|
||||
_data[fieldKey] = value;
|
||||
}
|
||||
|
||||
T? get<T>(String fieldKey) {
|
||||
final value = _data[fieldKey];
|
||||
if (value is T) return value as T;
|
||||
return null;
|
||||
}
|
||||
|
||||
void remove(String fieldKey) {
|
||||
_data.remove(fieldKey);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_data.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// Expected value shapes:
|
||||
/// - For multi-file uploads: List<UploadItem>
|
||||
class UploadItem {
|
||||
final String fileName;
|
||||
final Uint8List bytes;
|
||||
|
||||
UploadItem({required this.fileName, required this.bytes});
|
||||
}
|
||||
Reference in New Issue
Block a user