urldat library
urldat is a micro library that exposes urldat and urldatFactory functions. It is a simple utility that helps you with building URLs in intuitive way while also making sure URLs have correct format.
Example:
urldat('https://example.com/', '/:section/item', parameters: {
'section': 'users',
's': 'hello'
'id': 1,
});
This gives you https://example.com/users/item?s=hello&id=1
.
Enums
- UrldatErrorId
- ID for catching type of errors programatically
Functions
-
urldat(
String base, String pathOrTemplate, {Map< String, dynamic> ? parameters, String? scheme, int? port, String? fragment}) → String -
Function that takes
base
string URL andpathOrTemplate
string URL.pathOrTemplate
can be either: -
urldatFactory(
String base) → UrldatConfiguredFn -
This function creates a closure around base
urldat.urldat function. You pass
base
string URL to this factory function and closure is returned that allows you to call urldat.urldat without explicitly passingbase
again. All other arguments likepathOrTemplate
andparameters
apply. This is simply convenience function to make use of urldat more convenient.
Typedefs
Exceptions / Errors
- UrldatError
- Use this to detect when urldat.urldat throws due to invalid combination of inputs. If you want to detect types of error programatically, use id property which will give you UrldatErrorId identifier.