toJson method

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

A method which turns this AuthorizationRequest into a JSON representation which can be send over a MethodChannel.

Implementation

@override
Map<String, dynamic> toJson() {
  return <String, dynamic>{
    'type': 'appleid',
    if (nonce != null) 'nonce': nonce,
    if (state != null) 'state': state,
    'scopes': [
      for (final scope in scopes)
        if (scope == AppleIDAuthorizationScopes.email)
          'email'
        else if (scope == AppleIDAuthorizationScopes.fullName)
          'fullName',
    ],
  };
}