toJson method

Map<String, dynamic> toJson()

Serializes this metadata using RFC 9728 field names.

Implementation

Map<String, dynamic> toJson() => <String, dynamic>{
  'resource': resource.toString(),
  'authorization_servers': authorizationServers
      .map((server) => server.toString())
      .toList(growable: false),
  if (resourceName != null) 'resource_name': resourceName,
  if (resourceDocumentation != null)
    'resource_documentation': resourceDocumentation.toString(),
  if (scopesSupported.isNotEmpty) 'scopes_supported': scopesSupported,
  if (bearerMethodsSupported.isNotEmpty)
    'bearer_methods_supported': bearerMethodsSupported,
};