Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

flutter delete file

  Future<String> get _localPath async {
    final directory = await getApplicationDocumentsDirectory();

    return directory.path;
  }

  Future<File> get _localFile async {
    final path = await _localPath;
    print('path ${path}');
    return File('$path/counter.txt');
  }

  Future<int> deleteFile() async {
        try {
          final file = await _localFile;

          await file.delete();
        } catch (e) {
          return 0;
        }
      }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flutter #delete #file
ADD COMMENT
Topic
Name
9+3 =