isHas method

dynamic isHas(
  1. dynamic x
)

Implementation

isHas(x) async {
  String? text;
  try {
    Directory directory = await getApplicationDocumentsDirectory();
    File file = File('${directory.path}/$fileName.txt');

    text = await file.readAsString();
    var t = json.decode(text);
    text = t[x];

    return text!.isEmpty == true ? false : true;
  } catch (e) {
    print('error');
  }
}