ReplayFileSystem constructor

ReplayFileSystem({@required Directory recording })

Creates a new ReplayFileSystem.

Recording data will be loaded from the specified recording location. This location must have been created by RecordingFileSystem, or an ArgumentError will be thrown.

Implementation

factory ReplayFileSystem({
  @required Directory recording,
}) {
  String dirname = recording.path;
  String path = recording.fileSystem.path.join(dirname, kManifestName);
  File manifestFile = recording.fileSystem.file(path);
  if (!manifestFile.existsSync()) {
    throw new ArgumentError('Not a valid recording directory: $dirname');
  }
  List<Map<String, dynamic>> manifest = new JsonDecoder()
      .convert(manifestFile.readAsStringSync())
      .cast<Map<String, dynamic>>();
  return new ReplayFileSystemImpl(recording, manifest);
}