fromJson static method

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

Creates a new interval block from a JSON object

Implementation

static IntervalBlock fromJson(Map<String, dynamic> json) {
  return IntervalBlock(
    iterations: json['iterations'] as int,
    steps: json['steps']
        .map((step) => IntervalStep.fromJson(step as Map<String, dynamic>))
        .toList(),
    type: IntervalBlockType.values
        .firstWhere((e) => e.toString().split('.').last == json['type']),
  );
}