Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:io
  3. IOOverrides class
IOOverrides
description

IOOverrides classabstractbase

Facilities for overriding various APIs ofdart:io with mockimplementations.

This abstract base class should be extended with overrides for theoperations needed to construct mocks. The implementations in this base classdefault to the actualdart:io implementation. For example:

class MyDirectory implements Directory {  ...  // An implementation of the Directory interface  ...}void main() {  IOOverrides.runZoned(() {    ...    // Operations will use MyDirectory instead of dart:io's Directory    // implementation whenever Directory is used.    ...  }, createDirectory: (String path) => new MyDirectory(path));}

Constructors

IOOverrides()

Properties

hashCodeint
The hash code for this object.
no setterinherited
runtimeTypeType
A representation of the runtime type of the object.
no setterinherited
stderrStdout
The standard output stream of errors written by this program.
no setter
stdinStdin
The standard input stream of data read by this program.
no setter
stdoutStdout
The standard output stream of data written by this program.
no setter

Methods

createDirectory(Stringpath)Directory
Creates a newDirectory object for the givenpath.
createFile(Stringpath)File
Creates a newFile object for the givenpath.
createLink(Stringpath)Link
Returns a newLink object for the givenpath.
exit(intcode)→ Never
Exit the Dart VM process immediately with the given exit code.
fseGetType(Stringpath,boolfollowLinks)Future<FileSystemEntityType>
Asynchronously returns theFileSystemEntityType forpath.
fseGetTypeSync(Stringpath,boolfollowLinks)FileSystemEntityType
Returns theFileSystemEntityType forpath.
fseIdentical(Stringpath1,Stringpath2)Future<bool>
Asynchronously returnstrue ifpath1 andpath2 are paths to thesame file system object.
fseIdenticalSync(Stringpath1,Stringpath2)bool
Returnstrue ifpath1 andpath2 are paths to thesame file system object.
fsWatch(Stringpath,intevents,boolrecursive)Stream<FileSystemEvent>
Returns aStream ofFileSystemEvents.
fsWatchIsSupported()bool
Returnstrue whenFileSystemEntity.watch is supported.
getCurrentDirectory()Directory
Returns the current working directory.
getSystemTempDirectory()Directory
Returns the system temporary directory.
noSuchMethod(Invocationinvocation)→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serverSocketBind(dynamicaddress,intport, {intbacklog =0,boolv6Only =false,boolshared =false})Future<ServerSocket>
Asynchronously returns aServerSocket that connects to the given addressand port when successful.
setCurrentDirectory(Stringpath)→ void
Sets the current working directory to bepath.
socketConnect(dynamichost,intport, {dynamicsourceAddress,intsourcePort =0,Duration?timeout})Future<Socket>
Asynchronously returns aSocket connected to the given host and port.
socketStartConnect(dynamichost,intport, {dynamicsourceAddress,intsourcePort =0})Future<ConnectionTask<Socket>>
Asynchronously returns aConnectionTask that connects to the given hostand port when successful.
stat(Stringpath)Future<FileStat>
Asynchronously returnsFileStat information forpath.
statSync(Stringpath)FileStat
ReturnsFileStat information forpath.
toString()String
A string representation of this object.
inherited

Operators

operator ==(Objectother)bool
The equality operator.
inherited

Static Properties

currentIOOverrides?
no setter
globalIOOverrides?
TheIOOverrides to use in the rootZone.
no getter

Static Methods

runWithIOOverrides<R>(Rbody(),IOOverridesoverrides)→ R
Runsbody in a freshZone using the overrides found inoverrides.
runZoned<R>(Rbody(), {DirectorycreateDirectory(String)?,DirectorygetCurrentDirectory()?,voidsetCurrentDirectory(String)?,DirectorygetSystemTempDirectory()?,FilecreateFile(String)?,Future<FileStat>stat(String)?,FileStatstatSync(String)?,Future<bool>fseIdentical(String,String)?,boolfseIdenticalSync(String,String)?,Future<FileSystemEntityType>fseGetType(String,bool)?,FileSystemEntityTypefseGetTypeSync(String,bool)?,Stream<FileSystemEvent>fsWatch(String,int,bool)?,boolfsWatchIsSupported()?,LinkcreateLink(String)?,Future<Socket>socketConnect(dynamic,int, {dynamicsourceAddress,intsourcePort,Duration?timeout})?,Future<ConnectionTask<Socket>>socketStartConnect(dynamic,int, {dynamicsourceAddress,intsourcePort})?,Future<ServerSocket>serverSocketBind(dynamic,int, {intbacklog,boolshared,boolv6Only})?,Stdinstdin()?,Stdoutstdout()?,Stdoutstderr()?,Neverexit(int)?})→ R
Runsbody in a freshZone using the provided overrides.
  1. Dart
  2. dart:io
  3. IOOverrides class
dart:io library

[8]ページ先頭

©2009-2025 Movatter.jp