title: Use Flutter 'file', what is the correct path to read txt file in the lib directory?
body: <p>I am using the flutter 'file', trying to read a <code>txt</code> file in lib directory, but I do not know how should I write in code to read the file. I also do not know if I have placed the <code>txt</code> file at a right place, which means I do not know if I can read the file in the lib directory.</p>
  
  <p>I have put a <code>txt</code> file <code>words.txt</code> in the lib directory, where other dart files are put.</p>
  
  <p>Below is my code which tries to read the 'word.txt' file:</p>
  
  <pre><code>Future&lt;String&gt; readFile() async {
    var text;
    try {
      final directory = await getApplicationDocumentsDirectory();
      print(directory.path);
  
      final file = File('${directory.path}/lib/words.txt');
      text = await file.readAsString();
      return text;
    } catch (e) {
      print(e.message);
    }
  }
  </code></pre>
  
  <p>P.S. I have imported the 'dart:io' and 'path_provider.dart'.</p>
  
  <p>When I run the program, I can see the directory.path is printed in the console, however the e.message 'Cannot open file' is printed in the console.</p>
  
  <p>I think that the error is came from 'File('${directory.path}/lib/words.txt')', so i would like to know how should i write code to read the txt file in lib directory.</p>
  
  <p>Thanks.</p>