wt library

WondTech Flutter MVC framework.

A single import (package:wt_framework/wt.dart) exposes the app shell (WtApp), routing (WtRouter/WtRoute), the MVC building blocks (WtController, WtModel, WtView), global WtConfig, and the WtSession/WtSecurity/WtHelper utilities.

Classes

TimeAgoLabels
Localisable labels for WtHelper.timeAgo. Supply justNow and a format that turns a count + TimeUnit into a phrase, so any language — including its singular/dual/plural rules — plugs in without touching the framework.
WtApp
Root widget: a thin MaterialApp wired to a WtConfig and a WtRouter.
WtAsyncView<T>
A WtView that resolves a Future and renders loading/error/empty/data states automatically via a FutureBuilder. Implement loadData and buildData.
WtConfig
Global, immutable application configuration (the Flutter equivalent of wt_config.php). Initialise once in main() with WtConfig.init.
WtController
Base class for a screen's controller: owns the route settings, exposes route params, returns the screen's WtView, and offers navigation helpers. Subclass it and implement view.
WtHelper
Stateless UI + formatting helpers: dates/relative time, string casing & slugs, number/currency formatting, and flash/showLoading/confirm dialog utilities.
WtModel<T>
Base Model — a thin, typed HTTP client (the Flutter equivalent of a PHP model). v1.1 makes it production-ready: • injects Authorization: Bearer <token> from the session automatically, • unwraps an optional response envelope (WtConfig.envelopeKey), • surfaces the server error message (WtConfig.messageKey), • exposes low-level getJson/postJson/putJson/deleteJson/ postMultipart so action-style endpoints and file uploads are easy.
WtRoute
A single route: a path pattern (supports :param segments) and the builder that creates its controller.
WtRouter
Matches route names to WtRoutes and generates their pages.
WtSecurity
Small security utilities: request sanitize, HMAC hashWithKey, a random generateToken, email validation, and base64 encode/decode helpers.
WtSession
Persistent key/value session.
WtUpload
One file to attach to a multipart request.
WtView
Base class for a screen's view: a small template-style holder that carries assigned variables and builds a widget tree, with ready-made scaffold/loading/error/empty helpers.

Enums

TimeUnit
Time granularity emitted by WtHelper.timeAgo.

Typedefs

WtRouteBuilder = WtController Function(RouteSettings settings)
Builds the WtController for a matched route from its RouteSettings.

Exceptions / Errors

WtModelException
Thrown by WtModel when a request fails or the envelope reports an error; carries the server message and HTTP statusCode.