mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-07-05 09:34:37 +00:00
Make it easy to cache new data
This commit is contained in:
19
lib/models/cache_model.dart
Normal file
19
lib/models/cache_model.dart
Normal file
@ -0,0 +1,19 @@
|
||||
import 'package:comunic/helpers/database/database_contract.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
/// Cache base model
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
abstract class CacheModel {
|
||||
final int id;
|
||||
|
||||
const CacheModel({@required this.id}) : assert(id != null);
|
||||
|
||||
/// Initialize a CacheModel from a map
|
||||
CacheModel.fromMap(Map<String, dynamic> map)
|
||||
: id = map[BaseTableContract.C_ID];
|
||||
|
||||
/// Convert the object to a map
|
||||
Map<String, dynamic> toMap();
|
||||
}
|
Reference in New Issue
Block a user