migrate<T extends Model> static method
Registers a constructor for type T.
Required before any CRUD operations on T.
Example:
JsonFileModel.migrate<User>((json) => User.fromJson(json));
Implementation
static Future<void> migrate<T extends Model>({
required T Function(Map<String, dynamic>) constructor,
}) async {
final file = File("$_dir/${_getTableName<T>()}.json");
if (!await file.exists()) await file.create(recursive: true);
_jsonConstructors[T] = constructor;
}