Flutter wrapper for the UPCitemdb API.
Note: This is unofficial, experimental, non-production code.
For help getting started with Flutter, view the online documentation.
Clone this repository into your app's lib/src/lib
and use it like in this example:
import './src/lib/upc_item_db/lib/upc_item_db.dart';
UpcItemDb db = new UpcItemDB();
ItemsResponse response;
try {
response = await db.lookup(barcode);
} on ErrorResponse catch (e) {
// Exceeded rate limit or item not found
print(e.code + ': ' + e.message)
}
if (response != null) {
// Item lookup successful
Item firstItem = response.items[0];
print(firstItem.title);
}
Accepts a barcode string (UPC, ISBN or EAN).
UpcItemDb db = new UpcItemDB();
ItemsResponse response = await db.lookup(barcode);
Accepts a search string.
UpcItemDb db = new UpcItemDB();
ItemsResponse response = await db.lookup(barcode);
Contains a list of 0..n matched items.
class ItemsResponse {
String code;
int total;
int offset;
List<Item> items;
}
Matched item with default properties. (There may be more)
class Item {
String ean;
String title;
String description;
String brand;
String model;
String color;
String size;
String dimension;
String weight;
}
For help on editing package code, view the Flutter documentation.