BaseEntity constructor

BaseEntity({
  1. String? id,
  2. required bool dirty,
  3. String? created,
  4. String? lastUpdated,
  5. bool? skipDateUpdate = false,
})

Implementation

BaseEntity(
    {this.id,
    required this.dirty,
    this.created,
    this.lastUpdated,
    this.skipDateUpdate = false}) {
  this.id = this.id ?? DhisUidGenerator.generate();
  this.created = this.created ?? DateTime.now().toIso8601String();
  this.lastUpdated = this.lastUpdated ?? this.created;

  if (dirty &&
      (skipDateUpdate == null || skipDateUpdate == false) &&
      lastUpdated == null) {
    this.lastUpdated = DateTime.now().toIso8601String();
  }
}