flutter_fixtures_core 0.3.1
flutter_fixtures_core: ^0.3.1 copied to clipboard
Core interfaces and domain models for Flutter Fixtures
Changelog #
0.3.1 #
-
TrafficRecorder.run(an extension on the seam) owns the record-and-replay choreography for call/return sources — lazy description, decide, replay throughdecode, rejection viareject, live call then record — so a custom adapter is a description plus its live call.RecordedSourcesnames the built-in source strings (http,sqlite). -
BREAKING: the Selection Flow is now the
FixturePipeline<TRequest>module — one object owning source, strategy, view, delay and Selection Memory behind a singleserve(request). TheFixtureSelectormixin is gone; memory is scoped to the pipeline instance you build (once, for the lifetime you want choices remembered) instead of to whichever adapter mixed the flow in.FixtureMiss(FixtureNotFound/FixtureEmpty/FixtureCancelled) is a throwable outcome carrying its own message, so adapters raise the case itself and consumers never parse error text. -
BREAKING: delays are plain
Durations.DataSelectorDelaykeeps the four presets (instant,fast,moderate,slow) asDurationconstants;DataSelectorDelay.custom(ms),duration, andapplyare gone — pass anyDurationdirectly. -
BREAKING: one fixture-source seam for every domain.
FixtureSource<TRequest>is now the abstract seam (resolve(request)+data(document)), andHttpFixtureSourceis an alias forFixtureSource<HttpFixtureRequest>. The composite is the genericFixtureSources<TRequest>(HttpFixtureSourcesaliases it for HTTP). The former concreteFixtureSource(fixture-file IO) is nowFixtureFileSource<TRequest>, parameterized by the domain's naming convention;HttpFileFixtureSourceextends it and exposes that convention asHttpFileFixtureSource.candidateNames.
0.3.0 #
-
New thin record-and-replay seam:
TrafficRecorder(decide+record) with its contract types —RecordedRequest,RecordedInteraction, sealedReplayDecision(Replayed/ForwardToSource/RejectRequest), andReplayMissBehavior. Transport packages implement capture/replay against this seam; the engine ships separately influtter_fixtures_recorder. Both calls take builder functions invoked only when the recorder's mode needs them, so idle traffic costs nothing. -
HttpFixtureRequest.canonicalTarget: the escaped, sorted rendering of a request's identity, used as the record & replay match key — identical whichever HTTP client built the request. -
HttpFixtureRequest.fromUriis the canonical constructor: it owns HTTP request normalization (scheme and host dropped, the URL's query string merged intoqueryParameters), so sources see one shape and never compensate. Fixes fixture-file candidates for absolute request URLs, which previously came out asGET_https:__host_path.json. -
New
HttpFixtureSources, an ordered composite that is itself anHttpFixtureSource: first source to resolve wins and alone provides the selected document's payload. Source precedence now lives (and is tested) in core instead of each HTTP adapter. -
OpenApiFixtureSourceno longer strips schemes or query strings from request paths — that compensation moved behindfromUri; it keeps only the OpenAPI-specificserversbase-path handling. -
New
FixtureSelector.serveruns the whole fixture pipeline — find a collection, select a document, load its payload — and reports aFixtureOutcome(FixtureNotFound/FixtureEmpty/FixtureCancelled/FixtureServed). Adapters map outcomes to their own domain and error policy instead of each re-implementing the choreography. -
BREAKING: the
DataQueryinterface was removed. HTTP providers implementHttpFixtureSource; sqflite providers implementSqfliteFixtureSource(influtter_fixtures_sqflite); custom domains define their own source seam and drive it withFixtureSelector.serve. -
BREAKING:
FixtureSelectionMemorywas removed; remembered choices live insideFixtureSelector, scoped to the mixing-in instance and keyed by the same collection signature as pick deduplication. Clear them withclearRememberedSelectionFor/clearRememberedSelectionson the selector. The@visibleForTesting FixtureSelector.clearPendingPicksis gone with the static state that required it. -
New
HttpFixtureSourceseam: resolves anHttpFixtureRequest(method, path, query parameters) to aFixtureCollection. HTTP adapters consult an ordered list of sources; the first that resolves wins. Sources build model objects directly, so the fixture wire format lives only inFixtureCollection.fromJson/FixtureDocument.fromJsonand document invariants are enforced at construction. -
New
HttpFileFixtureSourceimplements the seam over fixture files, owning the HTTP file naming convention (moved fromDioDataQuery). -
New
OpenApiFixtureSourceimplements the seam over an OpenAPI 3.x JSON document: operation docs name the collection, and each response's status, description, and payload examples (or a schema-generated sample) become selectable documents.
0.2.0 #
- BREAKING:
DataSelectorView.picknow returnsFixtureChoice?(the chosen document plus a remember flag);nullmeans the user cancelled. - BREAKING:
DataSelectorTypeis now a plain enum (pick,defaultValue,random) instead of a sealed class hierarchy. - BREAKING:
FixtureDocumentrejects documents declaring bothdataanddataPath; invalid fixtures now fail at parse time. FixtureSelectorowns the full selection flow: it writes selection memory, deduplicates concurrent picks for the same collection, and propagates cancel asnull.- New
FixtureSourceconcentrates fixture-file IO (candidate resolution, JSON decoding, payload loading) behind the newFixtureAssetLoaderseam. - New
FixtureDocument.statusCodeexposes the leading 3-digit code of the description as a typed field. - New
FixtureCollection.fromJson/FixtureDocument.fromJsonown the fixture wire format.
0.1.3 #
- Support JSON arrays as response data in
DataQuery.
0.1.2 Response Delay #
- Add
DataSelectorDelayclass to simulate response delays. - Add delay to
FixtureSelector.selectmethod.
0.1.1 Selection Memory #
- Add in-memory selection memory to remember user choices for fixture collections.
- Add
FixtureSelectionMemoryclass to manage remembered selections. - Auto-select single option when using Pick selector.
0.1.0 First Minor Release #
- Updated all packages to version 0.1.0
- Renamed
Fixturemixin toFixtureSelectorfor better clarity - Improved documentation across all packages
- Added comprehensive CONTRIBUTING.md guide
- Added MIT License
- Updated GitHub repository references to brotoo25/flutter_fixtures
0.0.1 Initial Release #
- Initial release of Flutter Fixtures
- Restructured as a workspace with multiple packages:
- flutter_fixtures_core: Core interfaces and domain models
- flutter_fixtures_dio: Dio implementation
- flutter_fixtures_ui: UI components
- flutter_fixtures: Meta-package that depends on all the above
- Support for Dio HTTP client
- Three fixture selection modes: Random, Default, and Pick
- Dialog-based UI for user selection
- Example app demonstrating basic and advanced usage