File size: 694 Bytes
3382f47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import 'package:auto_gpt_flutter_client/models/task.dart';

class TestSuite {
  final String timestamp;
  final List<Task> tests;

  TestSuite({required this.timestamp, required this.tests});

  // Serialization: Convert the object into a Map
  Map<String, dynamic> toJson() {
    return {
      'timestamp': timestamp,
      'tests': tests.map((task) => task.toJson()).toList(),
    };
  }

// Deserialization: Create an object from a Map
  factory TestSuite.fromJson(Map<String, dynamic> json) {
    return TestSuite(
      timestamp: json['timestamp'],
      tests: List<Task>.from(json['tests'].map(
          (taskJson) => Task.fromMap(Map<String, dynamic>.from(taskJson)))),
    );
  }
}