get method

Future<Response> get({
  1. required String baseUrl,
  2. required String path,
  3. required String apiKey,
  4. Map<String, dynamic>? queryParams,
})

Implementation

Future<Response> get({
  required String baseUrl,
  required String path,
  required String apiKey,
  Map<String, dynamic>? queryParams,
}) async {
  final uri = Uri.https(
    _sanitizeDomain(baseUrl),
    path,
    queryParams,
  );

  final response =
      await Client().get(uri, headers: {'Authorization': 'token $apiKey'});

  if (response.statusCode != 200) {
    FlutterError.presentError(
      FlutterErrorDetails(
        exception: FailedFetchException(response.body),
        stack: StackTrace.current,
      ),
    );
  }

  return response;
}