// ignore_for_file: avoid_web_libraries_in_flutter

import 'package:web/web.dart' as web;

import 'locale_storage_backend.dart';
import 'locale_storage_engine.dart';

final LocaleStorageBackend localeStorage = LocaleStorageEngine(
  localTarget: LocaleStorageCallbackTarget(
    readCallback: (key) => web.window.localStorage.getItem(key),
    writeCallback: (key, value) => web.window.localStorage.setItem(key, value),
    removeCallback: (key) => web.window.localStorage.removeItem(key),
    clearCallback: () => web.window.localStorage.clear(),
  ),
  sessionTarget: LocaleStorageCallbackTarget(
    readCallback: (key) => web.window.sessionStorage.getItem(key),
    writeCallback: (key, value) =>
        web.window.sessionStorage.setItem(key, value),
    removeCallback: (key) => web.window.sessionStorage.removeItem(key),
    clearCallback: () => web.window.sessionStorage.clear(),
  ),
);
