toMap method

Map<String, dynamic> toMap({
  1. List<FlutsterTestEvent>? alternateEvents,
})

toMap returns a Map of the record including the events. If alternateEvents is given, the events are replaced in the returned map by this given list.

Implementation

Map<String, dynamic> toMap({List<FlutsterTestEvent>? alternateEvents}) {
  alternateEvents ??= events;
  Map<String, dynamic> ret = {
    "testName": testName,
  };
  if (firstRecordingStart?.millisecondsSinceEpoch != null) {
    ret.addAll({
      "firstRecordingStart": firstRecordingStart?.millisecondsSinceEpoch,
    });
  }
  ret.addAll({
    "events": alternateEvents.map((e) => e.toMap()).toList(),
  });
  return (ret);
}