title: Copying large file does not work in flutter
body: <p>I try to use a 665 MB size Database file (SQLite file) for my flutter app.
  (the file is needed since it provides offline-data for a public transportation App. And therefore I cannot make it smaller).</p>
  
  <p>So far, when using any SQLite file in Flutter, I normally copy it in code.
  The original location of the file is <code>./assets/db_file.db</code>.
  The destination location of the file is <code>DocumentsDirectory</code>.</p>
  
  <p>Now I have the problem that the file-copy does not work for my 665 MB large DB-file.</p>
  
  <p>Here is my code that fails to copy due to the large size of the file.</p>
  
  <p>(for smaller files, this code works well)...:</p>
  
  <p>(also, in the Simulator the code works well, no matter the large file-size. The problem only occurs on an actual iPhone)...</p>
  
  <pre><code>Directory directory = await getApplicationDocumentsDirectory();
  var dbPath = join(directory.path, "destinationFile.db");
  if (FileSystemEntity.typeSync(dbPath) == FileSystemEntityType.notFound) {
    ByteData data = await rootBundle.load("assets/largeFile.db");
    List&lt;int&gt; bytes =
        data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
    await File(dbPath).writeAsBytes(bytes);
  }
  </code></pre>
  
  <p>For my 665 MB file the above code crashes - without error message :/</p>
  
  <p>The line of code it crashes is the following:</p>
  
  <pre><code>ByteData data = await rootBundle.load("assets/largeFile.db");
  </code></pre>
  
  <p>Questions:</p>
  
  <ul>
  <li><p>is there any way to improve my above code for very large files so that no crash ocurrs ??</p></li>
  <li><p>is there any way to provide the db-file inside the documents-folder in the first place (as part of the bundle, i.e. so that no copying is needed) ??</p></li>
  <li><p>how should I proceed with such a large file anyway ??</p></li>
  </ul>