getData static method

Future<SpotifyMetadata> getData(
  1. String link
)

Get data from a youtube link

Implementation

static Future<SpotifyMetadata> getData(String link) async {
  final Uri uri = Uri.parse("https://open.spotify.com/oembed?url=$link");

  http.Response result;
  try {
    result = await http.get(uri);
  } catch (e) {
    throw 'Incorrect link';
  }
  return SpotifyMetadata.fromMap(json.decode(result.body));
}