getCapabilities static method

Future<Capabilities?> getCapabilities({
  1. required String spotifyUri,
})

Gets the Capabilities of the current user

Throws a PlatformException getting the capability failed Throws a MissingPluginException if the method is not implemented on the native platforms.

Implementation

static Future<Capabilities?> getCapabilities(
    {required String spotifyUri}) async {
  try {
    var capabilitiesJson =
        await _channel.invokeMethod<String>(MethodNames.getCapabilities);

    if (capabilitiesJson!.isNotEmpty) {
      var capabilitiesMap =
          jsonDecode(capabilitiesJson) as Map<String, dynamic>;
      return Capabilities.fromJson(capabilitiesMap);
    }

    return null;
  } on Exception catch (e) {
    _logException(MethodNames.getCapabilities, e);
    rethrow;
  }
}