0PricingLogin
Dart Academy · Lesson

Reading and Writing Files

Load and save text and bytes.

Why dart:io

To touch real files from a command-line program, you import dart:io. It gives Dart the power to read and write your disk.

import 'dart:io';

Meet the File Class

A File object points at a path on disk. Creating one does not open or read anything yet, it just names the target.

final file = File('notes.txt');

All lessons in this course

  1. Reading and Writing Files
  2. Directories, Paths, and FileSystemEntity
  3. Streaming Large Files
  4. Stdin, Stdout, and Process Args
← Back to Dart Academy