Run constructor Null safety

Run(
  1. {required String id,
  2. required bool isRaceDay,
  3. num distance = 0,
  4. double averageSpeed = 0,
  5. String userId = '',
  6. RunState state = RunState.running,
  7. Map<String, dynamic> meta = const {},
  8. num? timezoneOffset,
  9. String? end,
  10. Json? deviceInformations,
  11. String? eventId,
  12. String? created}
)

Implementation

Run({
  required this.id,
  required this.isRaceDay,
  this.distance = 0,
  this.averageSpeed = 0,
  this.userId = '',
  this.state = RunState.running,
  this.meta = const {},
  this.timezoneOffset,
  this.end,
  Json? deviceInformations,
  String? eventId,
  String? created,
})  : deviceInformations =
          deviceInformations ?? DeviceInformationModel.empty().toJson(),
      eventId = eventId ?? EngineConfig.name,
      created = created ?? DateTime.now().toIso8601String();