BrewApiClient constructor

BrewApiClient({
  1. required HttpGetFn httpGet,
})

Creates a BrewApiClient with the given HTTP GET function.

Example with package:http:

import 'package:http/http.dart' as http;

final client = BrewApiClient(
  httpGet: (url) async {
    final response = await http.get(url);
    if (response.statusCode != 200) {
      throw Exception('HTTP ${response.statusCode}');
    }
    return response.body;
  },
);

Implementation

BrewApiClient({required HttpGetFn httpGet}) : _get = httpGet;