parseMigrationManifestText function
Parses migration names from a manifest JSON payload.
Implementation
List<String> parseMigrationManifestText(String text) {
final decoded = jsonDecode(text);
if (decoded is! Map<String, Object?>) {
throw const FormatException('Migration manifest must be a JSON object.');
}
final migrations = decoded['migrations'];
if (migrations is! List<Object?>) {
throw const FormatException(
'Migration manifest must contain a "migrations" array.',
);
}
return migrations
.map((value) => '$value'.trim())
.where((value) => value.isNotEmpty)
.toList(growable: false);
}