AsserestFileAccess constructor

AsserestFileAccess(
  1. String ftpPath,
  2. bool success
)

Construct a file access property for ftpPath and determine is operated success or not.

ftpPath must be in absolute form or throws NonAbsolutePathException if not obey.

Implementation

factory AsserestFileAccess(String ftpPath, bool success) {
  final pathUri = Uri.file(ftpPath, windows: false);

  if (!pathUri.hasAbsolutePath) {
    // Unaccept relative path
    throw NonAbsolutePathException._(pathUri);
  }

  return AsserestFileAccess._(
      UnmodifiableListView(pathUri.pathSegments), success);
}