flutterflow_cloud_core 0.1.1-dev.1
flutterflow_cloud_core: ^0.1.1-dev.1 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. 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.
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 schedule/event kind or a nested trigger/schedule/delivery
key is rejected as an unsupported delivery at its exact pointer before the
structural check, matching the config compiler's functionKindUnsupported
(functions/02 §1). 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).
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.