Skip to main content

flutterflow_cloud_core 0.2.0 copy "flutterflow_cloud_core: ^0.2.0" to clipboard
flutterflow_cloud_core: ^0.2.0 copied to clipboard

Pure Dart Cloud values, errors and strict function contract codecs.

flutterflow_cloud_core #

Pure Dart values and local project generation shared by the Flutter app SDK, its project generator and the emulator. Runtime libraries have no Flutter dependency, transport, credential store, deployed resources or listening port. Keeping them separate lets the pure Dart emulator, which compiles with dart compile exe, use the same Functions value-schema validation as the app without depending on the Flutter app client or its ambient HTTP transport.

Surface #

flutterflow_cloud_core.dart exports the common record, query, user, file and geopoint values plus typed API errors and problem decoding. Recognized sign-in and account feature codes have plain userMessage copy with the original error code in parentheses and, when present, (ref <requestId>). Shared access/session codes (authenticationRequired, sessionRevoked, sessionExpired) keep their existing context-specific copy: they can mean an expired app ticket, a deleted account, or an older request finishing after a successful account switch. Apps show userMessage; detail, fix and toString() retain the builder's diagnostics. batch.dart exports canonical generated record/batch wire models and the common batch builders, which the app SDK re-exports as the same Dart types. dynamic_links.dart (also in the main library) exports the Dynamic Links values (specs/34 §4, §11): FFXDynamicLink (a resolved link and its router location, the path with its query keys sorted), FFXLinkCampaign (the five UTM fields), the short-code rules (isShortCode, shortCodeOfPath, the alphabet and reserved codes), linkLocation, locationOfAppSchemeUri (an "Open in app" URL read back as a route) and the build define names FFX_LINK_DOMAIN and FFX_LINK_SCHEME. The app SDK and the emulator share them; the shared golden table dynamic-links/test/fixtures/link-url-parity.json holds them to @flutterflow/dynamic-links. The errors map the four dynamicLinks* problem codes, with end-user copy, and carry FFXDynamicLinksNotConfiguredError, thrown before anything is sent by a build with no link host. function_values.dart exports strict bounded JSON parsing/encoding and function value-schema validation. encodeFunctionJson writes exactly the bytes the TypeScript encodeFunctionJson (JSON.stringify) writes for the same value: numbers by functionJsonNumber (an integral double below 1e21 without .0, negative zero as 0), and an object's array-index keys first in ascending order. The shared encodeCases goldens in schema/test/fixtures/functions-wire.json pin both encoders. Public function strings count Unicode scalars; validation against the generated TypeBox tables explicitly selects UTF-16 bounds to match TypeBox. A nullable type list accepts null before any enum is checked. The shared valueCases in schema/test/fixtures/functions-wire.json run through this validator and the independent TypeScript validateFunctionValue with the same expected outcome. function_contracts.dart validates standalone definitions against the generated TypeBox table, then semantic bounds, grants and paths. It returns recursively immutable canonical definitions; findings include a JSON pointer and fix. A definition's kind is callable, http or scheduled (functions/02 §4). Any other kind, and a nested trigger/event/eventType/subscription key, is rejected as an unsupported delivery at its exact pointer before the structural check, matching the config compiler's functionKindUnsupported (functions/02 §1); a schedule or delivery key on a callable or HTTP function is rejected at that key as the scheduled kind's own. A scheduled definition has no auth and capabilities.data: none (the closed table admits nothing else), and its schedule.cron must parse under parseFunctionCron (function_schedule.dart, exported by this library): the five-field grammar and @ macros of the TypeScript schedule engine (schema/src/functions/schedule.ts), checked for syntax and field ranges only, with the engine's messages, reported at /functions/<name>/schedule/cron. schedule.timeZone is checked by spelling alone (the table's pattern). The TypeScript config compiler is the authority on whether the zone exists in the platform's zone database, whether the schedule ever fires and whether its instants keep the platform's minimum interval (functionScheduleTimeZoneInvalid, functionScheduleNeverFires, functionScheduleTooFrequent); nothing in Dart computes an instant, so a definition this validator accepts can still fail ffx-functions check on those three findings. Config parsing explicitly selects a larger bounded nesting limit than callable values. Remote schemas are never resolved. JSON object validation checks actual string keys, including maps with dynamic Dart type arguments; it does not invoke custom toJson methods or coerce non-string keys.

The separate generator.dart library owns the project generator and its runGenerator CLI implementation, which emits the app's models, methods, options and typed callable function clients and never reads .ffx/functions.json: function handlers are TypeScript, written against the types ffx-functions generates (functions/02 §5). Only callable functions have an app binding: functions.g.dart exists whenever the config declares functions, and HTTP and scheduled functions contribute no model or method to it, since nothing in an app invokes them through the SDK. The app SDK re-exports this library and retains dart run flutterflow_cloud:generate. Canonical formatting uses the shared SDK language floor (Dart 3.11), 80 columns and automatic trailing commas with the selected pinned formatter. Destination package maps, analysis options and whether output directories already exist do not change those formatting inputs; --check still compares exact generated bytes. Only this explicit tooling library uses local filesystem/process APIs; runtime libraries do not import it. Generation requires an explicit functions map, including {} when disabled; it never defaults a missing section. Generation requires no analyzer or dependency resolution. The shared CLI reads project and options inputs only as bounded regular files through confined, non-link project ancestors; optional Pubspec prefix reads use the same boundary. Limits are 9 MiB for project config, 64 KiB for options and 2 MiB for Pubspec. Optional dangling links and special files reject instead of being skipped. Generated app paths reject links before writing or drift inspection. An explicit --out selects local output authority, with descendants still confined. Parser and formatter diagnostics never include source excerpts, option values or raw exceptions. These checks prevent pre-existing local path escapes; they are not an atomic hostile-filesystem boundary.

Dependencies and consumers #

Runtime dependencies are Dart SDK libraries only. Codegen owns the contract schema table; the app project generator re-exports its generator. The app SDK depends on it. The emulator checks the request shapes of the internal API it serves an attached local Functions host with its validateFunctionSchema. App Preview and the native app builder bundle its sources with the app SDK and include both packages in compilation identity.

Verification and contracts #

Resolve the backend pub workspace with the pinned Flutter SDK. Run dart analyze --fatal-infos and dart test in this directory. The consuming SDK suites also exercise these exact types and the shared adversarial function wire fixtures. See Dart SDK and Functions API.

1
likes
150
points
26.3k
downloads

Documentation

API reference

Publisher

verified publisherflutterflow.io

Weekly Downloads

Pure Dart Cloud values, errors and strict function contract codecs.

Repository (GitHub)

License

MIT (license)

More

Packages that depend on flutterflow_cloud_core