getVariants method
Fetches the variants enabled on Ditto
throws FailedFetchException if the request fails
Implementation
Future<List<Language>> getVariants({
required String baseUrl,
required String apiKey,
}) async {
final response = await _provider.get(
baseUrl: baseUrl,
apiKey: apiKey,
path: '/variants',
);
if (response.statusCode == 200) {
return (jsonDecode(response.body) as List<dynamic>)
.map((d) => Language.fromJson(d))
.toList();
}
throw FailedFetchException(response.body);
}