headers static method

Map<String, String> headers({
  1. String? token,
  2. bool auth = false,
})

Implementation

static Map<String, String> headers({String? token, bool auth = false}) {
  Map<String, String> header = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  };
  if (auth) {
    header['Authorization'] = 'Bearer $token';
  }
  return header;
}