Taint.fromJson constructor

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

Creates a Taint from JSON data.

Implementation

factory Taint.fromJson(Map<String, dynamic> json) {
  final tempEffectJson = json['effect'];
  final tempKeyJson = json['key'];
  final tempTimeAddedJson = json['timeAdded'];
  final tempValueJson = json['value'];

  final String tempEffect = tempEffectJson;
  final String tempKey = tempKeyJson;
  final DateTime? tempTimeAdded =
      tempTimeAddedJson != null ? DateTime.tryParse(tempTimeAddedJson) : null;
  final String? tempValue = tempValueJson;

  return Taint(
    effect: tempEffect,
    key: tempKey,
    timeAdded: tempTimeAdded,
    value: tempValue,
  );
}