save method

Future<void> save()

Saves the model to the database.

Implementation

Future<void> save() async {
  if (id != null) {
    await query.where('id', '=', id).update(toDatabaseJson());
  } else {
    await query.insert(toDatabaseJson());
  }
}