duxt library

Duxt - A modern meta-framework for Jaspr

Provides file-based routing, layouts, middleware, and more.

Usage

import 'package:duxt/duxt.dart';

For server API handlers:

import 'package:duxt/server.dart';

For content/documentation support:

import 'package:duxt/content.dart';

Classes

Api
Simple static API class for HTTP requests.
AsyncData<T>
Async data result holder.
AuthMiddleware
Authentication middleware example
DuxtContext
Context passed to asyncData and middleware
DuxtErrorPage
A polished error page component for Duxt applications.
DuxtLayout
Base class for Duxt layouts
DuxtMiddleware
Base class for Duxt middleware
DuxtMultiState<S extends StatefulComponent>
Base class for multiple data sources in SPA mode.
DuxtPage
Base class for Duxt pages
DuxtState<S extends StatefulComponent, T>
Base class for StatefulComponent states that handle async data loading in SPA mode.
GuestMiddleware
Guest-only middleware (redirect if authenticated)

Mixins

AsyncDataMixin
Mixin for pages that need async data loading
LayoutDataMixin
Mixin for layouts that need to provide data to children

Extensions

DuxtNavigation on BuildContext
Extension on BuildContext for convenient navigation.

Functions

paramOr(RouteState state, String name, String defaultValue) String
Helper to get optional route param with default.
queryParam(RouteState state, String name) String?
Helper to get query param.
queryParamOr(RouteState state, String name, String defaultValue) String
Helper to get query param with default.
requireParam(RouteState state, String name) String
Helper to extract route params in component constructors.
useRouter(BuildContext context) → RouterState
Get the router state from context.

Typedefs

RouteStateCallback = Component Function(BuildContext context, RouteState state)
Get route state from the builder callback.

Exceptions / Errors

ApiException
API exception with status code and response body.
ErrorException
RedirectException