toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  Map<String, dynamic> result = <String, dynamic>{
    _userIDKey: userID,
    _deviceKey: user
  };

  if (durationSeconds != null) {
    result[_durationKey] = durationSeconds;
  }

  if (methods != null) {
    List<String> stringMethods = <String>[];
    for (var m in methods!) {
      stringMethods.add(m.toShortString());
    }
    result[_methodsKey] = stringMethods;
  }

  return result;
}