Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/barredterra/what_the_code
Flutter wrapper for the UpcItemDb API
https://github.com/barredterra/what_the_code
api-wrapper barcode barcode-reader barcodes dartlang flutter flutter-plugin
Last synced: 27 days ago
JSON representation
Flutter wrapper for the UpcItemDb API
- Host: GitHub
- URL: https://github.com/barredterra/what_the_code
- Owner: barredterra
- License: mit
- Created: 2018-06-30T20:37:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-30T21:12:40.000Z (over 6 years ago)
- Last Synced: 2024-11-08T05:40:41.908Z (3 months ago)
- Topics: api-wrapper, barcode, barcode-reader, barcodes, dartlang, flutter, flutter-plugin
- Language: Dart
- Homepage:
- Size: 82 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Flutter wrapper for the [UPCitemdb](http://www.upcitemdb.com) API.
Note: This is **unofficial, experimental, non-production** code.
# Getting started
For help getting started with Flutter, view the online [documentation](https://flutter.io/docs).Clone this repository into your app's `lib/src/lib` and use it like in this example:
```dart
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);
}
```# Methods
## lookup()
Accepts a barcode string (UPC, ISBN or EAN).```dart
UpcItemDb db = new UpcItemDB();
ItemsResponse response = await db.lookup(barcode);
```## search()
Accepts a search string.```dart
UpcItemDb db = new UpcItemDB();
ItemsResponse response = await db.lookup(barcode);
```# Response Objects
## ItemsResponse
Contains a list of 0..n matched items.```dart
class ItemsResponse {
String code;
int total;
int offset;
List items;
}
```## Item
Matched item with default properties. (There may be more)```dart
class Item {
String ean;
String title;
String description;
String brand;
String model;
String color;
String size;
String dimension;
String weight;
}
```# Contributing
For help on editing package code, view the Flutter [documentation](https://flutter.io/developing-packages/).