authorize static method

Asks for the user's permission to access their music library.

If the user hasn't granted permission yet, a popup will be displayed. On subsequent calls, the popup won't be displayed. This method will always return the latest authorization status and can be called multiple times.

Implementation

static Future<AuthorizationStatus> authorize() async {
  final response = await _channel.invokeMethod<int>('authorize');

  if (response == null) {
    throw PlatformException(code: "NULL_RESPONSE");
  }

  return AuthorizationStatus.values[response];
}