core
library
Classes
ArgParser
A class for taking a list of raw command line arguments and parsing out
options and flags from them.
ArgResults
The results of parsing a series of command line arguments using
ArgParser.parse .
BytesBuilder
Builds a list of bytes, allowing bytes and lists of bytes to be added at the
end.
CollectionStyle
An enum of collection styles.
CompressionOptions
Options controlling compression in a WebSocket .
ConnectionTask <S >
A cancelable connection attempt.
ContentType
A MIME/IANA media type used as the value of the
HttpHeaders.contentTypeHeader header.
Context
An instantiable class for manipulating paths. Unlike the top-level
functions, this lets you explicitly select what platform the paths will use.
Cookie
Representation of a cookie. For cookies received by the server as Cookie
header values only name and value properties will be set. When building a
cookie for the 'set-cookie' header in the server and when receiving cookies
in the client as 'set-cookie' headers all fields can be used.
Datagram
A data packet received by a RawDatagramSocket .
Directory
A reference to a directory (or folder ) on the file system.
File
A reference to a file on the file system.
FileLock
Type of lock when requesting a lock on a file.
FileMode
The modes in which a File can be opened.
FileStat
The result of calling the POSIX stat()
function on a file system object.
FileSystemCreateEvent
File system event for newly created file system objects.
FileSystemDeleteEvent
File system event for deletion of file system objects.
FileSystemEntity
The common superclass of File , Directory , and Link .
FileSystemEntityType
The type of an entity on the file system,
such as a file, directory, or link.
FileSystemEvent
Base event class emitted by FileSystemEntity.watch .
FileSystemModifyEvent
File system event for modifications of file system objects.
FileSystemMoveEvent
File system event for moving of file system objects.
GZipCodec
The GZipCodec encodes raw bytes to GZip compressed bytes and decodes GZip
compressed bytes to raw bytes.
Representation of a header value in the form:
HttpClient
An HTTP client for communicating with an HTTP server.
HttpClientBasicCredentials
Represents credentials for basic authentication.
HttpClientBearerCredentials
Represents credentials for bearer token authentication.
HttpClientCredentials
Represents credentials for authentication in HttpClient .
HttpClientDigestCredentials
Represents credentials for digest authentication.
HttpClientRequest
HTTP request for a client connection.
HttpClientResponse
HTTP response for a client connection.
HttpConnectionInfo
Information about an HttpRequest , HttpResponse , HttpClientRequest , or
HttpClientResponse connection.
HttpConnectionsInfo
Summary statistics about an HttpServer s current socket connections.
HttpDate
Utility functions for working with dates with HTTP specific date
formats.
Headers for HTTP requests and responses.
HttpOverrides
This class facilitates overriding HttpClient with a mock implementation.
It should be extended by another class in client code with overrides
that construct a mock implementation. The implementation in this base class
defaults to the actual HttpClient implementation. For example:
HttpRequest
A server-side object
that contains the content of and information about an HTTP request.
HttpResponse
An HTTP response, which returns the headers and data
from the server to the client in response to an HTTP request.
HttpServer
A server that delivers content, such as web pages, using the HTTP protocol.
HttpSession
The HttpRequest.session of an HttpRequest .
HttpStatus
HTTP status codes. Exported in dart:io and dart:html.
Immutable
Used to annotate a class.
InternetAddress
An internet address or a Unix domain address.
InternetAddressType
The type, or address family, of an InternetAddress .
IOOverrides
Facilities for overriding various APIs of dart:io
with mock
implementations.
IOSink
A combined byte and text output.
Link
References to filesystem links.
NetworkInterface
A NetworkInterface represents an active network interface on the current
system. It contains a list of InternetAddress es that are bound to the
interface.
Option
A command-line option.
OptionType
What kinds of values an option accepts.
PathMap <V >
A map whose keys are paths, compared using p.equals and p.hash .
PathSet
A set containing paths, compared using p.equals and p.hash .
Pipe
An anonymous pipe that can be used to send data in a single direction i.e.
data written to write can be read using read .
Platform
Information about the environment in which the current program is running.
Process
The means to execute a program.
ProcessCmd
Process command
ProcessInfo
Methods for retrieving information about the current process.
ProcessResult
The result of running a non-interactive
process started with Process.run or Process.runSync .
ProcessSignal
On Posix systems, ProcessSignal is used to send a specific signal
to a child process, see Process.kill
.
ProcessStartMode
Modes for running a new process.
RandomAccessFile
Random access to the data in a file.
RawDatagramSocket
An unbuffered interface to a UDP socket.
RawSecureServerSocket
A server socket providing a stream of low-level RawSecureSocket s.
RawSecureSocket
RawSecureSocket
provides a secure (SSL or TLS) network connection.
RawServerSocket
A listening socket.
RawSocket
A TCP connection.
RawSocketEvent
Events for the RawDatagramSocket , RawSecureSocket , and RawSocket .
RawSocketOption
The RawSocketOption is used as a parameter to Socket.setRawOption and
RawSocket.setRawOption to customize the behaviour of the underlying
socket.
RawSynchronousSocket
A low-level class for communicating synchronously over a TCP socket.
RawZLibFilter
The RawZLibFilter class provides a low-level interface to zlib.
ReadPipe
The "read" end of an Pipe created by Pipe.create .
RecordUse
Annotates a static method to be recorded.
RedirectInfo
Redirect information.
Required
Used to annotate a named parameter p
in a method or function f
.
ResourceHandle
A wrapper around OS resource handle so it can be passed via Socket
as part of SocketMessage .
SameSite
Cookie cross-site availability configuration.
ScalarStyle
An enum of source scalar styles.
SecureServerSocket
A server socket, providing a stream of high-level Socket s.
SecureSocket
A TCP socket using TLS and SSL.
SecurityContext
The object containing the certificates to trust when making
a secure client connection, and the certificate chain and
private key to serve from a secure server.
ServerSocket
A listening socket.
Shell
Multiplatform Shell utility to run a script with multiple commands.
ShellEnvironment
Shell modifiable helpers. should not be modified after being set.
ShellEnvironmentAliases
Shell environment aliases for executable
ShellEnvironmentPaths
Shell environment ordered paths helper. Changes the PATH variable
ShellEnvironmentVars
Shell environment variables helper. Does not affect the PATH variable
ShellLinesController
Basic bi-directionnal shell lines controller.
ShellOptions
Shell options.
Socket
A TCP connection between two sockets.
SocketControlMessage
Control message part of the SocketMessage received by a call to
RawSocket.readMessage .
SocketDirection
The SocketDirection is used as a parameter to Socket.close and
RawSocket.close to close a socket in the specified direction(s).
SocketMessage
A socket message received by a RawDatagramSocket .
SocketOption
An option for a socket which is configured using Socket.setOption .
SourceEdit
A class representing a change on a String , intended to be compatible with
package:analysis_server
's SourceEdit .
Stdin
The standard input stream of the process.
StdioType
The type of object a standard IO stream can be attached to.
Stdout
An IOSink connected to either the standard out or error of the process.
Style
An enum type describing a "flavor" of path.
SystemEncoding
The system encoding is the current code page on Windows and UTF-8 on Linux
and Mac.
TagDirective
A directive describing a custom tag handle.
TlsProtocolVersion
A Transport Layer Security (TLS) version.
UseResult
See useResult for more details.
VersionDirective
A directive indicating which version of YAML a document was written to.
WebSocket
A two-way HTTP communication object for client or server applications.
WebSocketStatus
WebSocket status codes used when closing a WebSocket connection.
WebSocketTransformer
The WebSocketTransformer provides the ability to upgrade a
HttpRequest to a WebSocket connection. It supports both
upgrading a single HttpRequest and upgrading a stream of
HttpRequest s.
WritePipe
The "write" end of an Pipe created by Pipe.create .
X509Certificate
X509Certificate represents an SSL certificate, with accessors to
get the fields of the certificate.
YamlDocument
A YAML document, complete with metadata.
YamlEditor
An interface for modifying YAML documents while preserving comments
and whitespaces.
YamlList
A read-only List parsed from YAML.
YamlMap
A read-only Map parsed from YAML.
YamlNode
An interface for parsed nodes from a YAML source tree.
YamlScalar
A wrapped scalar value parsed from YAML.
ZLibCodec
The ZLibCodec encodes raw bytes to ZLib compressed bytes and decodes ZLib
compressed bytes to raw bytes.
ZLibDecoder
The ZLibDecoder is used by ZLibCodec and GZipCodec to decompress data.
ZLibEncoder
The ZLibEncoder encoder is used by ZLibCodec and GZipCodec to compress
data.
ZLibOption
Exposes ZLib options for input parameters.
Constants
alwaysThrows
→ const _AlwaysThrows
Used to annotate a function f
. Indicates that f
always throws an
exception. Any functions that override f
, in class inheritance, are also
expected to conform to this contract.
awaitNotRequired
→ const _AwaitNotRequired
Used to annotate a Future -returning function (including constructors,
getters, methods, and operators), or a Future -typed field (including
top-level, instance, and static) f
. Indicates that the Future value that
f
returns does not need to be awaited. Any methods that override f
in
class inheritance, are also expected to conform to this contract.
checked
→ const _Checked
Used to annotate a parameter of an instance method that overrides another
method.
dartChannelBeta
→ const String
Beta channel.
dartChannelDev
→ const String
Dev channel.
dartChannelMaster
→ const String
Master channel.
dartChannelStable
→ const String
Stable channel.
doNotStore
→ const _DoNotStore
Used to annotate a method, getter, top-level function, or top-level getter
to indicate that the value obtained by invoking it should not be stored in a
field or top-level variable. The annotation can also be applied to a class
to implicitly annotate all of the valid members of the class, or applied to
a library to annotate all of the valid members of the library, including
classes. If a value returned by an element marked as doNotStore
is
returned from a function or getter, that function or getter should be
similarly annotated.
doNotSubmit
→ const _DoNotSubmit
Used to annotate an optional parameter, method, getter or top-level getter
or function that is not intended to be accessed in checked-in code, but
might be ephemerally used during development or local testing.
experimental
→ const _Experimental
Used to annotate a library, or any declaration that is part of the public
interface of a library (such as top-level members, class members, and
function parameters) to indicate that the annotated API is experimental and
may be removed or changed at any-time without updating the version of the
containing package, despite the fact that it would otherwise be a breaking
change.
factory
→ const _Factory
Used to annotate an instance or static method m
. Indicates that m
must
either be abstract or must return a newly allocated object or null
. In
addition, every method that either implements or overrides m
is implicitly
annotated with this same annotation.
gzip
→ const GZipCodec
An instance of the default implementation of the GZipCodec .
immutable
→ const Immutable
Used to annotate a class C
. Indicates that C
and all subtypes of C
must be immutable.
internal
→ const _Internal
Used to annotate a declaration which should only be used from within the
package in which it is declared, and which should not be exposed from said
package's public API.
isTest
→ const _IsTest
Used to annotate a test framework function that runs a single test.
isTestGroup
→ const _IsTestGroup
Used to annotate a test framework function that runs a group of tests.
license
→ const String
生成文件的固定头
literal
→ const _Literal
Used to annotate a const constructor c
. Indicates that any invocation of
the constructor must use the keyword const
unless one or more of the
arguments to the constructor is not a compile-time constant.
mustBeConst
→ const _MustBeConst
Used to annotate a parameter which should be constant.
mustBeOverridden
→ const _MustBeOverridden
Used to annotate an instance member m
declared on a class or mixin C
.
Indicates that every concrete subclass of C
must directly override m
.
mustCallSuper
→ const _MustCallSuper
Used to annotate an instance member (method, getter, setter, operator, or
field) m
. Indicates that every invocation of a member that overrides m
must also invoke m
. In addition, every method that overrides m
is
implicitly annotated with this same annotation.
nonVirtual
→ const _NonVirtual
Used to annotate an instance member (method, getter, setter, operator, or
field) m
in a class C
or mixin M
. Indicates that m
should not be
overridden in any classes that extend or mixin C
or M
.
optionalTypeArgs
→ const _OptionalTypeArgs
Used to annotate a class, mixin, extension, function, method, or typedef
declaration C
. Indicates that any type arguments declared on C
are to
be treated as optional.
protected
→ const _Protected
Used to annotate an instance member in a class or mixin which is meant to
be visible only within the declaring library, and to other instance members
of the class or mixin, and their subtypes.
redeclare
→ const _Redeclare
Used to annotate an instance member of an extension type that
redeclares a member from a superinterface.
reopen
→ const _Reopen
Annotation for intentionally loosening restrictions on subtyping that would
otherwise cause lint warnings to be produced by the implicit_reopen
lint.
required
→ const Required
Used to annotate a named parameter p
in a method or function f
.
Indicates that every invocation of f
must include an argument
corresponding to p
, despite the fact that p
would otherwise be an
optional parameter.
sealed
→ const _Sealed
Annotation marking a class as not allowed as a super-type
outside of the current package.
systemEncoding
→ const SystemEncoding
The current system encoding.
useResult
→ const UseResult
Used to annotate a method, field, or getter within a class, mixin, or
extension, or a or top-level getter, variable or function to indicate that
the value obtained by invoking it should be used. A value is considered used
if it is assigned to a variable, passed to a function, or used as the target
of an invocation, or invoked (if the result is itself a function).
virtual
→ const _Virtual
Used to annotate a field that is allowed to be overridden in Strong Mode.
visibleForOverriding
→ const _VisibleForOverriding
Used to annotate an instance member that was made public so that it could be
overridden but that is not intended to be referenced from outside the
defining library.
visibleForTesting
→ const _VisibleForTesting
Used to annotate a declaration that was made public, so that it is more
visible than otherwise necessary, to make code testable.
zlib
→ const ZLibCodec
An instance of the default implementation of the ZLibCodec .
Functions
absolute (String part1 , [String ? part2 , String ? part3 , String ? part4 , String ? part5 , String ? part6 , String ? part7 , String ? part8 , String ? part9 , String ? part10 , String ? part11 , String ? part12 , String ? part13 , String ? part14 , String ? part15 ])
→ String
Returns a new path with the given path parts appended to current .
argumentsToString (List <String > arguments )
→ String
Convert multiple arguments to string than can be used in a terminal
argumentToString (String argument )
→ String
Helper to run a process and connect the input/output for verbosity
basename (String path )
→ String
Gets the part of path
after the last separator.
basenameWithoutExtension (String path )
→ String
Gets the part of path
after the last separator, and without any trailing
file extension.
canonicalize (String path )
→ String
Canonicalizes path
.
dirname (String path )
→ String
Gets the part of path
before the last separator.
equals (String path1 , String path2 )
→ bool
Returns true
if path1
points to the same location as path2
, and
false
otherwise.
executableArgumentsToString (String executable , List <String > ? arguments )
→ String
Convenient way to display a command
exit (int code )
→ Never
Exit the Dart VM process immediately with the given exit code.
extension (String path , [int level = 1 ])
→ String
Gets the file extension of path
: the portion of basename from the last
.
to the end (including the .
itself).
fromUri (Object ? uri )
→ String
Returns the path represented by uri
, which may be a String or a Uri .
getCLILockFile ()
→ File
获取项目cli的lock文件
getCLIVersion ()
→ Future <String >
获取CLI的本地版本
getFlutterBinChannel ()
→ Future <String ? >
Get flutter channel. (dev, beta, master, stable)
getFlutterBinVersion ()
→ Future <Version? >
Get flutter version.
getRemoteVersion (String package )
→ Future <String >
获取package
的最新版本
getYamlFile ([String name = 'pubspec.yaml' ])
→ Future <File >
获取指定的yaml文件
gitBranch ()
→ Future <String >
gitBuildInfo ()
→ Future <String >
利用git生成类似于"branch_short_yyMMddHHmm"的构建信息
gitCommitCount ()
→ Future <String >
获取git提交次数
gitDate ()
→ Future <String >
gitShort ()
→ Future <String >
hash (String path )
→ int
Returns a hash code for path
such that, if equals returns true
for two
paths, their hash codes are the same.
isAbsolute (String path )
→ bool
Returns true
if path
is an absolute path and false
if it is a
relative path.
isRelative (String path )
→ bool
Returns true
if path
is a relative path and false
if it is absolute.
On POSIX systems, absolute paths start with a /
(forward slash). On
Windows, an absolute path starts with \\
, or a drive letter followed by
:/
or :\
.
isRootRelative (String path )
→ bool
Returns true
if path
is a root-relative path and false
if it's not.
isWithin (String parent , String child )
→ bool
Returns true
if child
is a path beneath parent
, and false
otherwise.
join (String part1 , [String ? part2 , String ? part3 , String ? part4 , String ? part5 , String ? part6 , String ? part7 , String ? part8 , String ? part9 , String ? part10 , String ? part11 , String ? part12 , String ? part13 , String ? part14 , String ? part15 , String ? part16 ])
→ String
Joins the given path parts into a single path using the current platform's
separator . Example:
joinAll (Iterable <String > parts )
→ String
Joins the given path parts into a single path using the current platform's
separator . Example:
loadYaml (String yaml , {Uri ? sourceUrl , bool recover = false , ErrorListener? errorListener })
→ dynamic
Loads a single document from a YAML string.
loadYamlDocument (String yaml , {Uri ? sourceUrl , bool recover = false , ErrorListener? errorListener })
→ YamlDocument
Loads a single document from a YAML string as a YamlDocument .
loadYamlDocuments (String yaml , {Uri ? sourceUrl })
→ List <YamlDocument >
Loads a stream of documents from a YAML string.
loadYamlNode (String yaml , {Uri ? sourceUrl , bool recover = false , ErrorListener? errorListener })
→ YamlNode
Loads a single document from a YAML string as a YamlNode .
loadYamlStream (String yaml , {Uri ? sourceUrl })
→ YamlList
Loads a stream of documents from a YAML string.
normalize (String path )
→ String
Normalizes path
, simplifying it by handling ..
, and .
, and
removing redundant path separators whenever possible.
prettyUri (Object ? uri )
→ String
Returns a terse, human-readable representation of uri
.
processCmdToDebugString (ProcessCmd cmd )
→ String
Process command debug string
processResultToDebugString (ProcessResult result )
→ String
Process result debug string
prompt (String ? text , {Stream <List <int > > ? stdin })
→ Future <String >
Get text
promptConfirm (String ? text , {Stream <List <int > > ? stdin })
→ Future <bool >
Confirm action
promptTerminate ()
→ Future
Terminate a prompt session.
registerAssets (List <String > paths )
→ Future <void >
判断资源目录是否已经注册到pubspec.yaml文件中
registerPackage (String package , [String position = 'dependencies' ])
→ Future <void >
position:
dependencies
dev_dependencies
dependency_overrides
relative (String path , {String ? from })
→ String
Attempts to convert path
to an equivalent relative path from the current
directory.
rootPrefix (String path )
→ String
Returns the root of path
, if it's absolute, or the empty string if it's
relative.
run (String script , {bool throwOnError = true , String ? workingDirectory , Map <String , String > ? environment , bool includeParentEnvironment = true , bool ? runInShell , Encoding stdoutEncoding = systemEncoding , Encoding stderrEncoding = systemEncoding , Stream <List <int > > ? stdin , StreamSink <List <int > > ? stdout , StreamSink <List <int > > ? stderr , bool verbose = true , bool ? commandVerbose , ShellOptions ? options , ShellOnProcessCallback ? onProcess })
→ Future <List <ProcessResult > >
Run one or multiple plain text command(s).
runExecutableArguments (String executable , List <String > arguments , {String ? workingDirectory , Map <String , String > ? environment , bool includeParentEnvironment = true , bool ? runInShell , Encoding ? stdoutEncoding = systemEncoding , Encoding ? stderrEncoding = systemEncoding , Stream <List <int > > ? stdin , StreamSink <List <int > > ? stdout , StreamSink <List <int > > ? stderr , bool ? verbose , bool ? commandVerbose , bool ? noStdoutResult , bool ? noStderrResult , ShellOnProcessCallback ? onProcess })
→ Future <ProcessResult >
if commandVerbose
or verbose
is true, display the command.
if verbose
is true, stream stdout & stdin
runExecutableArgumentsSync (String executable , List <String > arguments , {String ? workingDirectory , Map <String , String > ? environment , bool includeParentEnvironment = true , bool ? runInShell , Encoding ? stdoutEncoding = systemEncoding , Encoding ? stderrEncoding = systemEncoding , StreamSink <List <int > > ? stdout , StreamSink <List <int > > ? stderr , bool ? verbose , bool ? commandVerbose })
→ ProcessResult
if commandVerbose
or verbose
is true, display the command.
if verbose
is true, stream stdout & stdin
runPubGet ()
→ Future <bool >
执行"flutter pub get"命令
runSync (String script , {bool throwOnError = true , String ? workingDirectory , Map <String , String > ? environment , bool includeParentEnvironment = true , bool ? runInShell , Encoding stdoutEncoding = systemEncoding , Encoding stderrEncoding = systemEncoding , StreamSink <List <int > > ? stdout , StreamSink <List <int > > ? stderr , bool verbose = true , bool ? commandVerbose , ShellOptions ? options })
→ List <ProcessResult >
Run one or multiple plain text command(s).
runUpdateCLI ()
→ Future <bool >
执行flutter pub run build_runner build
setExtension (String path , String extension )
→ String
Returns path
with the trailing extension set to extension
.
shellArgument (String argument )
→ String
Use to safely enclose an argument if needed
shellArguments (List <String > arguments )
→ String
Convert multiple arguments to string than can be used in a terminal
shellExecutableArguments (String executable , List <String > arguments )
→ String
Convert executable + arguments to a single script line
shellStreamLines (Stream <List <int > > stream , {Encoding ? encoding })
→ Stream <String >
Basic line streaming. Assuming system encoding
sleep (Duration duration )
→ void
Sleep for the duration specified in duration
.
split (String path )
→ List <String >
Splits path
into its components using the current platform's separator .
stdioType (dynamic object )
→ StdioType
Whether a stream is attached to a file, pipe, terminal, or
something else.
stringToArguments (String command )
→ List <String >
Convert a string command to arguments.
toUri (String path )
→ Uri
Returns the URI that represents path
.
userLoadEnv ({Map <String , String > ? vars , List <String > ? paths , Map <String , String > ? aliases })
→ void
Only specify the vars to override and the paths to add
userLoadEnvFile (String path )
→ void
Update userPaths and userEnvironment
which (String command , {Map <String , String > ? environment , bool includeParentEnvironment = true })
→ Future <String ? >
Find the command according to the paths
or env variables (PATH
)
whichSync (String command , {Map <String , String > ? environment , bool includeParentEnvironment = true })
→ String ?
Find the command according to the paths
or env variables (PATH
)
withoutExtension (String path )
→ String
Removes a trailing extension from the last part of path
.
wrapAsYamlNode (Object ? value , {CollectionStyle collectionStyle = CollectionStyle.ANY , ScalarStyle scalarStyle = ScalarStyle.ANY })
→ YamlNode
Wraps value
into a YamlNode .