createLichessDioClientWith function

Dio createLichessDioClientWith({
  1. String? accessToken,
  2. String baseUrl = 'https://lichess.org',
})

Implementation

Dio createLichessDioClientWith({
  String? accessToken,
  String baseUrl = 'https://lichess.org',
}) {
  final Map<String, String> headers = <String, String>{};

  if (accessToken != null) {
    headers['Authorization'] = 'Bearer $accessToken';
  }

  return Dio(
    BaseOptions(
      baseUrl: baseUrl,
      headers: headers,
    ),
  );
}