TomFallbackPlatformUtils class
A fallback implementation of TomPlatformUtils.
This class provides default behavior when no platform-specific implementation has been configured. Most methods throw UnimplementedError to indicate that a proper implementation should be provided.
The only methods with working implementations are:
- out - prints to standard output
- outError - prints to standard output
- getBrowserLocation - returns empty string
- getIsolateName - returns empty string
When to Use
This fallback is automatically used when the application hasn't configured a platform implementation. It's primarily useful during testing or when only console output functionality is needed.
Example
// This is the default - no explicit setup needed
TomPlatformUtils.current.out('Hello'); // Works with fallback
// This will throw UnimplementedError with fallback
TomPlatformUtils.current.isDesktop(); // Throws!
- Inheritance
-
- Object
- TomPlatformUtils
- TomFallbackPlatformUtils
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getBrowserLocation(
) → String? -
Returns the current browser URL location, if applicable.
override
-
getIsolateName(
) → String -
Returns the name of the current isolate.
override
-
getTomEnvVars(
) → Map< String, String> -
Returns the platform-specific environment variables.
inherited
-
httpClient(
) → Client -
Creates and returns a platform-appropriate HTTP client.
override
-
isAndroid(
) → bool -
Returns
trueif running on Android.override -
isDesktop(
) → bool -
Returns
trueif running on a desktop platform.override -
isFuchsia(
) → bool -
Returns
trueif running on Fuchsia OS.override -
isIos(
) → bool -
Returns
trueif running on iOS.override -
isLinux(
) → bool -
Returns
trueif running on Linux.override -
isMacOs(
) → bool -
Returns
trueif running on macOS.override -
isMobile(
) → bool -
Returns
trueif running on a mobile platform.override -
isWeb(
) → bool -
Returns
trueif running in a web browser environment.override -
isWindows(
) → bool -
Returns
trueif running on Microsoft Windows.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
out(
String s) → void -
Outputs a message to the console.
override
-
outError(
String s) → void -
Outputs an error message to the console.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited