
import 'package:shared_preferences/shared_preferences.dart';


class AppData {
  static Map<String, dynamic> _data = new Map<String, dynamic>();

  static dynamic get(String key) {
    return _data[key];
  }

  static void set(String key, dynamic value) {
    _data[key] = value;
  }

  static void clear() {
    _data.clear();
  }
}

class Cache {
  static SharedPreferences _prefs;

  static Future init() async {
    try {
      _prefs = await SharedPreferences.getInstance();
    } catch (err) {
      print(err);
    }
  }

  static void del(String key) {
    _prefs.remove(key);
  }

  static void set(String key, String value) {
    _prefs.setString(key, value);
  }

  static String get(String key) {
    return _prefs.getString(key);
  }

  static void clear() {
    _prefs.clear();
  }
}