init method

Future<void> init()

Initializes the cache dir, nothing else will work unless you do this first.

Implementation

Future<void> init() async {
  if (!kIsWeb) {
    cacheDir = Directory(
        join((await getApplicationCacheDirectory()).path, "cid-cache"));
    await cacheDir?.create(recursive: true);
  } else {
    // If this function gets called in web nothing should happen
    // Caching doesn't happen so any functions with `cacheDir` should be skipped
    // and the file will be streamed/held in memory.
    // It's not a perfect solution, but web is quite restrictive so it's all I got.
  }
}