productDeleteLocal function

dynamic productDeleteLocal()

Implementation

productDeleteLocal() async {
  if (kIsWeb) {
    // MapEntry<String, String>? data;
    // try {
    //   data = localStorage.entries.firstWhere((i) => i.key == "products.json");
    // } on StateError {
    //   data = null;
    // }
    // if (data != null) {
    //   var _data = json.decode(data.value) as Map<String, dynamic>;
    //   work(_data);
    // }
  } else {
    try {
      var directory = await getApplicationDocumentsDirectory();
      var directoryPath = directory.path;
      var _file = File('$directoryPath/products.json');
      if (await _file.exists())
        await _file.delete();
    } catch (ex) {
      dprint("productDeleteLocal $ex");
    }
  }
}