Services class
The app's services. Implements the runtime's CodelesslyServices seam; actions and data sources reach the rest through the typed fields.
- Implemented types
- Available extensions
Constructors
-
Services({ServiceConfig? config, ApiService? api, KeyValueCache? cache, FileCache? fileCache, LocalStorage? storage, AuthService? auth, CloudDatabase? cloud, CloudFileStorage? files, AnalyticsService? analytics, PurchaseService? purchases, PaywallRuntime? paywalls, TestStoreMode testStore = TestStoreMode.auto, bool? web, SoundService? sound, SpeechService? speech, LinkOpener? links, FileExporter? exports, FilePicker? filePicker, ScriptRunner? scripts, MediaExportService? mediaExport, PrintService? printing, List<
Object> extras = const []})
Properties
- analytics → AnalyticsService
-
final
- api → ApiService
-
HTTP API calls.
final
- auth → AuthService
-
App user accounts (the
authvalue, auth actions).final - cache → KeyValueCache
-
Cached values (publish models, auth data, paywalls).
final
- cloud → CloudDatabase
-
Cloud documents and queries (data-bound lists, cloud data actions).
final
- config ↔ ServiceConfig
-
What the publish model configures (APIs, paywall setup); the app
shell sets it when a publish model loads.
getter/setter pair
- exports → FileExporter
-
Saves generated files with the browser or platform save picker.
final
-
extras
→ List<
Object> -
More services, of the app's own features: found by type, as the
built-in ones are (service).
final
- fileCache → FileCache
-
Cached files (fonts, images).
final
- filePicker → FilePicker
-
Lets the person choose files (a pickFile action, a cloudFiles upload
without a
source): the platform's file dialog by default.final - files → CloudFileStorage
-
Cloud files (uploads).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- links → LinkOpener
-
final
- mediaExport → MediaExportService
-
Browser WebM export, or an encoder supplied by a native host.
final
- paywalls → PaywallRuntime?
-
Server-resolved paywalls and entitlements, when the app has a paywall
backend; the test store's while usesTestStore.
no setteroverride
- paywallsChanged → Listenable
-
Notifies when paywalls (and purchases) switch between the test
store and the app's.
no setteroverride
- printing → PrintService
-
final
- purchases → PurchaseService
-
Store purchases (the test store's while usesTestStore).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scripts → ScriptRunner
-
Runs scripts (run script actions): the platform's sandbox by default
(no engine without package:codelessly_quickjs on a device).
final
-
The device's share panel (a share action): the browser's on the web;
elsewhere none unless the app gives one, and the action copies to the
clipboard.
final
- sound → SoundService
-
final
- speech → SpeechService
-
Text-to-speech (speak actions, the
speechvalue).final - storage → LocalStorage
-
The app's values on the device (storage actions, the
storagevalue).final - testStore → TestStoreMode
-
When paywalls run on the test store (TestStoreMode): by default when
the published paywall setup has
"testStore": trueand the app runs on the web (web); TestStoreMode.force for the editor's run preview and tests. The test store never charges and never grants a real entitlement (TestStore).final - usesTestStore → bool
-
Whether paywalls run on the test store now: paywalls and
purchases are then the test store's.
no setter
- web → bool
-
Whether the app runs on the web, where there is no store (default:
kIsWeb; tests set it).
final
Methods
-
callApi(
String apiId, {Json params = const {}, Object? previousData, void onState(ApiResponse state)?}) → Future< Object?> -
Calls the API
apiIdof config with input valuesparams(already evaluated). Returns its response value (ApiResponse.toValue), 2xx or not;onStategets the loading state and then the result (an API's variable). Throws ApiRequestFailed (carrying the error value) when the request didn't complete, and a StateError for an unknown API.override -
dispose(
) → Future< void> - Releases what the services hold.
-
lookup<
T extends Object> () → T? -
Available on CodelesslyServices, provided by the ServiceLookup extension
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openUrl(
String url) → Future< bool> -
Opens
url(links).override -
service<
T extends Object> () → T? -
The service of type
T: one of the typed fields below (the paywalls and purchases in use now), config, or one of extras.override -
toString(
) → String -
A string representation of this object.
inherited
-
watchAuth(
) → Stream< Map< String, Object?> > -
The
authvalue (authValue): the user and their profile document, now and on every change of either.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited