UrlService class

Provides methods for generating URLs, assets, and routes.

Constructors

UrlService({String? assetBaseUrl, bool forceHttps = false, Map<String, String>? namedRoutes})

Properties

assetBaseUrl String
Get the asset base URL.
no setter
baseUrl String
Get the base URL.
no setter
hashCode int
The hash code for this object.
no setterinherited
namedRoutes Map<String, String>
Get all named routes.
no setter
routeNames List<String>
Get all registered route names.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asset(String path, {Map<String, dynamic>? query}) String
Generate a URL to an asset.
css(String path, {Map<String, dynamic>? query}) String
Generate a URL to a CSS file.
hasRoute(String name) bool
Check if a route is registered.
image(String path, {Map<String, dynamic>? query}) String
Generate a URL to an image.
isSecure(String url) bool
Check if the given URL is secure (HTTPS).
isValidUrl(String url) bool
Check if the given URL is valid.
js(String path, {Map<String, dynamic>? query}) String
Generate a URL to a JavaScript file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerRoute(String name, String path) → void
Register a named route.
removeRoute(String name) → void
Remove a named route.
route(String name, {Map<String, String>? parameters, Map<String, dynamic>? query}) String
Generate a URL for a named route.
secure(String path, {Map<String, dynamic>? query}) String
Generate a secure URL (HTTPS) to the given path.
storage(String path, {Map<String, dynamic>? query}) String
Generate a URL to a file in storage.
to(String path, {Map<String, dynamic>? query}) String
Generate a full URL to the given path.
toString() String
A string representation of this object.
inherited
url(String path, {Map<String, dynamic>? query}) String
Generate a full URL to the given path.

Operators

operator ==(Object other) bool
The equality operator.
inherited