init method

  1. @override
Future<void> init(
  1. bool persistSession,
  2. bool ignoreExpires
)
override

Initialization for the Storage, e.g. prepare storage paths.

Implementation

@override
Future<void> init(bool persistSession, bool ignoreExpires) async {
  // 4 indicates v4 starts to use a new path.
  String baseDir = dir?.replaceAll('\\', '/') ?? '.cookies/4/';
  if (!baseDir.endsWith('/')) {
    baseDir += '/';
  }
  final StringBuffer sb = StringBuffer(baseDir)
    ..write('ie${ignoreExpires ? 1 : 0}')
    ..write('_ps${persistSession ? 1 : 0}')
    ..write('/');
  _currentDirectory = sb.toString();
  await _makeCookieDir();
}