init method

void init({
  1. required String baseUrl,
  2. String? token,
  3. List<ApiHelperPathItem>? paths,
  4. Response resolver(
    1. dynamic
    )?,
  5. int timeout = 30000,
})

Implementation

void init({
  required String baseUrl,
  String? token,
  List<ApiHelperPathItem>? paths,
  response_helper.Response Function(dynamic)? resolver,
  int timeout = 30000,
}) {
  _baseUrl = baseUrl;
  _token = token;
  responseResolver = resolver;

  _dio = Dio(
    BaseOptions(
      baseUrl: _baseUrl,
      connectTimeout: Duration(milliseconds: timeout),
      sendTimeout: Duration(milliseconds: timeout),
      receiveTimeout: Duration(milliseconds: timeout),
    ),
  );

  _applyToken();

  if (paths != null) {
    for (final p in paths) {
      _paths[p.key] = p;
    }
  }
}