builder_helpers library
Build-time helpers re-exposed for other generators that compose
with gisila's annotations (notably gisila_doc).
Most application authors do not need to import this file;
package:gisila/gisila.dart covers everything needed at runtime
and package:gisila/builder.dart exposes the build_runner entry
point.
Functions
-
dartString(
String value) → String -
Quotes
valueas a Dart single-quoted string literal. -
emitGuardsRouteConfigLiteral(
{required bool requireAuth, required Set< String> permissions, required Set<String> anyPermission, required Set<String> roles, required bool isPublic}) → String -
Synthesises a
RouteConfigliteral that carries auth / permission guards collected from@RequireAuth/@Permissions/@AnyPermission/@Roles/@Publicannotations. -
emitNamedMiddlewareConfig(
Iterable< String> names) → String? -
Renders a list of class-and-method
@UseMiddlewarenames into aRouteConfigliteral that places them inmiddleware:asapp.namedMiddleware(...)lookups. -
emitRouteConfigLiteral(
DartObject? obj) → String -
Emits a Dart source literal that reconstructs the const
RouteConfig represented by
obj. Returns'RouteConfig.empty'ifobjisnull. -
fromFormConstructor(
ClassElement cls) → ConstructorElement? -
Returns the
fromForm(Map<String, dynamic>)factory ifclsexposes one. Used to decode form-urlencoded / multipart request bodies, with priority over fromJsonConstructor when both exist. -
fromJsonConstructor(
ClassElement cls) → ConstructorElement? -
isCoercible(
DartType type) → bool - Standard primitives we can parse from a path / query / header string.
-
isFormData(
DartType type) → bool -
True iff
typeisFormDatafrompackage:gisila. -
isFormSubtype(
DartType type) → bool -
True iff
typeis (a subclass of) the gisilaFormclass. -
isGisilaLibrary(
LibraryElement library) → bool -
True for a library of package:gisila itself. Annotations are matched by
where they are declared, not by name: a
PublicorRolesclass from any other package (even one named likegisila_extras) is not ours. -
isNullable(
DartType type) → bool -
True iff
typeisT?(orNull). -
isRequestContext(
DartType type) → bool -
True iff
typeisRequestContextfrompackage:gisila. -
isServiceSubtype(
DartType type) → bool -
True iff
typeis (a subclass of) the gisilaServiceclass. -
isShelfRequest(
DartType type) → bool -
isShelfResponse(
DartType type) → bool -
isStringMap(
DartType type) → bool -
isUploadedFile(
DartType type) → bool -
True iff
typeisUploadedFilefrompackage:gisila. -
isVoid(
DartType type) → bool -
joinPath(
String prefix, String suffix) → String - Joins a controller prefix with a method-level path, collapsing trailing/leading slashes.
-
listElementType(
DartType type) → DartType? -
pathPlaceholders(
String path) → Iterable< String> -
stringSetLiteral(
Iterable< String> values) → String -
Renders a Dart
<String>{...}literal (or<String>{}for empty). -
toShelfPath(
String path) → String -
Converts an OpenAPI-style path like
/users/{id}to the shelf_router-style path/users/<id>. -
typeDisplayName(
DartType type) → String - Display string with the nullability suffix stripped.
-
typeDisplayNameNullable(
DartType type) → String - Display string with explicit nullability suffix preserved.
-
unwrapFuture(
DartType type) → DartType