InAppLocalhostServer class
This class allows you to create a simple server on http://localhost:[port]/
in order to be able to load your assets file on a local server.
The default port value is 8080.
Constructors
-
InAppLocalhostServer({int port = 8080, String directoryIndex = 'index.html', String documentRoot = './', Future<
bool> onData(HttpRequest request)?}) -
This class allows you to create a simple server on
http://localhost:[port]/in order to be able to load your assets file on a local server. The defaultportvalue is8080. - InAppLocalhostServer.fromPlatform(PlatformInAppLocalhostServer platform)
- Constructs a InAppLocalhostServer from a specific platform implementation.
- InAppLocalhostServer.fromPlatformCreationParams(PlatformInAppLocalhostServerCreationParams params)
- Constructs a InAppLocalhostServer from creation params for a specific platform.
Properties
- directoryIndex → String
-
represents the index file to use. The default value is
index.html.no setter - documentRoot → String
-
Represents the document root path to serve. The default value is
./.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
onData
→ Future<
bool> Function(HttpRequest request)? -
A custom callback that is called when a new request is received by the server
that can be used to send or modify the response, for example adding custom headers.
If this callback returns
true, it means that the request has been handled by this callback. Otherwise, if this callback returnsfalse, the server will continue to process the request using the default implementation.no setter - platform → PlatformInAppLocalhostServer
-
Implementation of PlatformInAppLocalhostServer for the current platform.
final
- port → int
-
Represents the port of the server. The default value is
8080.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
Specifies whether additional
HttpServerobjects can bind to the same combination ofaddress,portandv6Only. Ifsharedistrueand moreHttpServers from this isolate or other isolates are bound to the port, then the incoming connections will be distributed among all the boundHttpServers. Connections can be distributed over multiple isolates this way.no setter
Methods
-
close(
) → Future< void> - Closes the server.
-
isRunning(
) → bool - Indicates if the server is running or not.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
start(
) → Future< void> -
Starts the server on
http://localhost:[port]/. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isClassSupported(
{TargetPlatform? platform}) → bool -
Check if the current class is supported by the defaultTargetPlatform or a specific
platform. -
isMethodSupported(
PlatformInAppLocalhostServerMethod method, {TargetPlatform? platform}) → bool -
Check if the given
methodis supported by the defaultTargetPlatform or a specificplatform.