toJson method

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

Converts the object to a JSON-encodable object.

Implementation

@override
Map<String, Object> toJson() => {
      'type': type,
      'id': id,
      if (attributes.isNotEmpty) 'attributes': attributes,
      if (relationships.isNotEmpty) 'relationships': relationships,
      if (links.isNotEmpty) 'links': links,
      if (meta.isNotEmpty) 'meta': meta,
    };