Lifecycle.fromJson constructor

Lifecycle.fromJson(
  1. Map<String, dynamic> json
)

Creates a Lifecycle from JSON data.

Implementation

factory Lifecycle.fromJson(Map<String, dynamic> json) {
  final tempPostStartJson = json['postStart'];
  final tempPreStopJson = json['preStop'];

  final LifecycleHandler? tempPostStart = tempPostStartJson != null
      ? LifecycleHandler.fromJson(tempPostStartJson)
      : null;
  final LifecycleHandler? tempPreStop = tempPreStopJson != null
      ? LifecycleHandler.fromJson(tempPreStopJson)
      : null;

  return Lifecycle(
    postStart: tempPostStart,
    preStop: tempPreStop,
  );
}