0

I need to know whether or not the file exists in the folder, but I get an instance of Future<bool>, how do I get the false or true?

for (String curFile in splittedList){
  Future<bool> t2 = Future.value(File(curFile).exists());
  print("$curFile - $t2");
}

result

I/flutter (16852): assets/images/Symbol/4.svg - Instance of 'Future<bool>'
Valentin Vignal
  • 6,151
  • 2
  • 33
  • 73

1 Answers1

0

var t2 = await File('...').exists()

hope it helpful.

EDIT -----

try this

  Future<bool> checkAssets(String key) async {
    bool result = true;
    try {
      await rootBundle.load(key);
    } catch (e) {
      result = false;
    }
    return result;
  }
Greed
  • 21
  • 2