Last updated:
0 purchases
kfc russia api
API for receiving data from KFC Russia. The library has a class with static methods for retrieving data.
Usage #
Receive a dio response from KFC Russia with information about restaurants, and outputting the request data to the console:
import 'package:kfc_russia_api/kfc_russia_api.dart';
void main() async {
final kfcRestaurants = await KFC.getRestaurants();
print('kfcRestaurants: $kfcRestaurants');
}
copied to clipboard
Output of product data:
import 'package:kfc_russia_api/kfc_russia_api.dart';
void main() async {
final kfcMenuOfDefaultRestaurant = await KFC.getMenu();
final menuData =
kfcMenuOfDefaultRestaurant.data?['value'] as Map<String, dynamic>;
final products = menuData['products'] as Map<String, dynamic>;
final product = products.values.first;
print("""Id: ${product['productId']}
Title: ${product['translation']['en']['title']}
Image URL: ${await KFC.getImageUrl(product['media']['image'])}""");
}
OUTPUT:
Id: 198345
Title: Green Tea large
Image URL: https://s82079.cdn.ngenix.net/nunvk035chfabj311zn6upgczg2a
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.