dataMode property
DVModuleDataMode
get
dataMode
Where this module's data lives, as the parent declared it.
Defaults to DVModuleDataMode.shared, which is the specification's default. An unrecognised value is refused rather than falling back: falling back would put a module's tables in the parent's database because somebody mistyped a word in a pubspec, and nothing would say so.
Implementation
DVModuleDataMode get dataMode {
final Object? declared = config['data'];
if (declared == null) return DVModuleDataMode.shared;
return switch ('$declared'.trim()) {
'' || 'shared' => DVModuleDataMode.shared,
'schema-isolated' => DVModuleDataMode.schemaIsolated,
'database-isolated' => DVModuleDataMode.databaseIsolated,
'remote' => DVModuleDataMode.remote,
final String other => throw StateError(
'Module "$id" declares data mode "$other", which is not one of '
'shared, schema-isolated, database-isolated or remote. A mode '
'nobody recognises is not treated as shared: that would put this '
"module's tables in the application's database because of a typo.",
),
};
}