Browser constructor

Browser({
  1. List<String>? profileDirPrefixes,
  2. String? historyDir,
  3. String? sqlite3Path,
})

Implementation

Browser({
  this.profileDirPrefixes,
  this.historyDir,
  this.sqlite3Path,
}) {
  if (sqlite3Path != null) {
    open.overrideForAll(() => DynamicLibrary.open(sqlite3Path!));
  }

  Map<String, String> envVars = Platform.environment;
  if (Platform.isWindows) {
    assert(windowsPath != null);

    var homedir = envVars['UserProfile']!;
    historyDir = join(homedir, windowsPath);
  } else if (Platform.isMacOS) {
    assert(macPath != null);

    var homedir = envVars['HOME']!;
    historyDir = join(homedir, macPath);
  } else if (Platform.isLinux) {
    assert(linuxPath != null);

    var homedir = envVars['HOME']!;
    historyDir = join(homedir, linuxPath);
  } else {
    throw UnimplementedError();
  }

  var prefixes = profileDirPrefixes ?? [];

  if (profileSupport && prefixes.isEmpty) {
    prefixes.add('*');
  }
}