Pub pub points Likes Popularity CI License
pub package pub points likes popularity CI License

Flutter API wrapper for Open Brewery DB.

Open Brewery DB is a free dataset and API with public information on breweries, cideries, brewpubs, and bottleshops. The goal of Open Brewery DB is to maintain an open-source, community-driven dataset and provide a public API. It is our belief that public information should be freely accessible for the betterment of the beer community and the happiness of web developers and data analysts.

Features

List Breweries Get Brewery Search Brewery

Getting started

Install

Add package:

dependencies:
  open_brewery_db: ^0.0.6

Run in your project directory

$ flutter pub get

Import it

import 'package:open_brewery_db/open_brewery_db.dart';

Usage

Get Brewery by Id

Usage

Future<Brewery> getBrewery({required String id})

Example

OpenBreweryDb.getBrewery(id: "sierra-nevada-brewing-co-chico")

List Breweries

Usage

Future<List<Brewery>> listBreweries({
    String? byCity,
    LatLng? byDist,
    String? byName,
    String? byState,
    String? byPostal,
    BreweryType? byType,
    int? byPage,
    int? perPage,
    List<SortFieldType> sortFields = const [],
    Sort? sortOrder,
  })

Examples

OpenBreweryDb.listBreweries(
          byCity: "Sacramento",
          sortFields: [SortFieldType.name],
          sortOrder: Sort.asc,
        ),
OpenBreweryDb.listBreweries(
          byState: "California",
          byCity: "San Diego",
          sortFields: [SortFieldType.street],
          sortOrder: Sort.desc,
        ),
OpenBreweryDb.listBreweries(
          byDist: LatLng(latitude: 38.5816, longitude: -121.4944), // Sacramento, CA
        ),

Search Breweries

Usage

Future<List<Brewery>> searchBreweries({
    required String query,
  })

Examples

OpenBreweryDb.searchBreweries(query: "Sierra Nevada")
OpenBreweryDb.searchBreweries(query: "Chico California")

Data

 Future<Brewery>
Future<List<Brewery>>
Brewery
  final String? id;
  final String? name;
  final String? breweryType;
  final String? street;
  final String? address_2;
  final String? address_3;
  final String? city;
  final String? state;
  final String? countyProvince;
  final String? postalCode;
  final String? country;
  final String? longitude;
  final String? latitude;
  final String? phone;
  final String? websiteUrl;
  final String? updatedAt;
  final String? createdAt;

Roadmap

  • x Add documentation comments
  • Add autocomplete endpoint
  • Write thorough tests for get brewery (simple tests are implemented for now)
  • Write thorough tests for list breweries (simple tests are implemented for now)
  • Write thorough tests for search breweries (simple tests are implemented for now)

Additional information

Pull requests are very much welcomed!

OBDB Frequently Asked Questions

Libraries

open_brewery_db