toJson method

Map<String, dynamic> toJson()

Serialize to JSON.

Implementation

Map<String, dynamic> toJson() => {
      'id': id,
      'title': title,
      if (description != null) 'description': description,
      'panels': panels.map((p) => p.toJson()).toList(),
      if (variables.isNotEmpty)
        'variables': variables.map((v) => v.toJson()).toList(),
      if (refreshInterval != null)
        'refreshIntervalMs': refreshInterval!.inMilliseconds,
      if (timeRange != null) 'timeRangeMs': timeRange!.inMilliseconds,
    };