toJson method

  1. @override
Map<String, dynamic> toJson()
override

Returns a serialized JSON structure of the model which also includes fields used by the database.

Implementation

@override
Map<String, dynamic> toJson() {
  return {
    if (id != null) 'id': id,
    'serverId': serverId,
    'time': time.toJson(),
    if (module != null) 'module': module,
    if (endpoint != null) 'endpoint': endpoint,
    if (method != null) 'method': method,
    if (duration != null) 'duration': duration,
    if (numQueries != null) 'numQueries': numQueries,
    if (slow != null) 'slow': slow,
    if (error != null) 'error': error,
    if (stackTrace != null) 'stackTrace': stackTrace,
    if (authenticatedUserId != null)
      'authenticatedUserId': authenticatedUserId,
    if (isOpen != null) 'isOpen': isOpen,
    'touched': touched.toJson(),
  };
}