FromJsonFactory<T extends TetherModel<T> > typedef
FromJsonFactory<T extends TetherModel<T> > =
T Function(Map<String, dynamic> json)
A typedef for a factory function that creates an instance of TModel
from a JSON map.
This is typically used for deserializing data fetched from a remote source (like Supabase) or a local database into a specific TetherModel type.
Example:
class MyModel extends TetherModel<MyModel> {
// ... model properties and methods
static MyModel fromJson(Map<String, dynamic> json) {
return MyModel(id: json['id'], name: json['name']);
}
// ... other methods
}
// Usage with AuthManager or other services:
final authManager = AuthManager<MyModel>(
// ... other parameters
profileFromJsonFactory: MyModel.fromJson,
);
Implementation
typedef FromJsonFactory<T extends TetherModel<T>> =
T Function(Map<String, dynamic> json);