1
0
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:
2019-04-24 13:56:56 +02:00
parent f8298919c2
commit 7f41f0dae1
5 changed files with 117 additions and 56 deletions

View 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();
}