get static method

Future get(
  1. String endpoint, {
  2. Map<String, dynamic>? params,
  3. Map<String, String>? headers,
  4. Function? callback,
  5. bool log = true,
})

Sends a GET request.

Implementation

static Future<dynamic> get(
  String endpoint, {
  Map<String, dynamic>? params,
  Map<String, String>? headers,
  Function? callback,
  bool log = true,
}) async {
  ServerRequest request = ServerRequest(
    method: 'GET',
    endpoint: endpoint,
    params: params,
    url: url!,
  );

  Response response;

  response = await request.send(log: log);

  if (callback != null) {
    return callback(jsonDecode(response.body));
  }

  return response;
}