config library

The Dart form of the dartvel: section of pubspec.yaml.

A project can write dartvel: dartvel_config.dart and declare its configuration as a class instead:

import 'package:dartvel_core/config.dart';

class const AppConfig() extends DartvelConfig {

  @override
  List<DVFileAssociation> get fileAssociations => const <DVFileAssociation>[
        DVFileAssociation(mimeType: 'application/x-shop-order', extensions: <String>['order']),
      ];
}

The build turns the class into the same object the YAML would have been with DartvelConfig.toPubspec, so the two are one configuration: every field has the same name, default and validation in both.

A separate library rather than part of dartvel.dart, because the generated client barrel already has a DartvelConfig (its constants), and a page importing both would not compile.

Classes

DartvelConfig
A project's configuration, written in Dart.
DartvelPubspecConfig
The configuration a dartvel: object describes, as a DartvelConfig.
DVFileAssociation
One file type the application opens.
DVFileAssociationsParse
What reading fileAssociations found.
DVHtmlSnippet
Raw HTML placed in the page as it is written: either html itself, or the contents of a file under html/.
DVOpenTelemetryConfig
OpenTelemetry export as a project declares it, and as a deployment's environment overrides it.
DVPlatformSettings
dartvel.platforms: each platform's own settings.
DVPlatformSettingsRead
What reading dartvel.platforms found.
DVWebDocumentSlots
The three edges of every web page a project can put its own HTML at.
DVWebFileRef
A file of the project under html/, as a value rather than a path.
DVWebSettings
dartvel.platforms.web.

Enums

DVDocumentSlot
One of the three edges.
DVFileAssociationRole
What the application does with a file of this type.
DVLogLevel
How much a record matters, in the order everyone already expects.
DVOtelSampler
The OpenTelemetry samplers, by their OTEL_TRACES_SAMPLER names.
DVOtelSignal
The three OpenTelemetry signals.
DVOtlpProtocol
How OTLP is put on the wire. Both are OTLP over HTTP; gRPC is not built (see the docs page for why), and a collector serves HTTP on 4318 by default.

Constants

dvAndroidOpenActivityClass → const String
The Activity dartvel build android writes to receive the files the application is opened with or shared, in JNI's slash-separated form. The intent filters are on it rather than on MainActivity, which is the developer's; it copies each file into the cache, queues it, brings the application forward and finishes.
dvHtmlSnippetDirectory → const String
The folder snippet files are kept in.
dvIosOpenedFilesKey → const String
Where the iOS app delegate leaves the files it was opened with, as a JSON list of {path, name} copied out of their security scope, until the Flutter runtime takes them.
dvPlatformNames → const List<String>
The platforms whose settings used to sit straight under dartvel:.

Functions

dvApplyDocumentSlots(String html, DVWebDocumentSlots slots, {String readFile(String path)?}) → String
html with slots at their edges, replacing any slots it already had, so a build over a previous build's output does not add a second copy.
dvBodyEndInsertionPoint(String html) → int
Where content that belongs at the end of the body goes: before the body-end slot when the page has one, so that slot stays last, and before </body> otherwise. -1 when the page has no body.
dvDocumentSlotCloseFor(String comment) → String?
Whether comment opens one of the slot regions the minifier must copy as written; the matching close marker when it does.
dvDocumentSlotCspSources(DVWebDocumentSlots slots, {String readFile(String path)?}) → Map<String, List<String>>
The third-party origins the snippets load from, by the directive that governs each load: script-src for a <script src>, style-src for a stylesheet, frame-src for an iframe, img-src for an image, media-src for audio and video. Same-origin and relative URLs need no addition, and plain-http URLs are left out: a secure page refuses them whatever its policy says.
dvHtmlSnippetProblems(String html, {required DVDocumentSlot slot}) → List<String>
Why html would break the page if placed in slot: an element left open that would swallow what follows, a closing tag that closes the page's own elements, page structure, or (in the head) an element a head cannot hold.
dvLegacyPlatformKeys(Map<Object?, Object?> section) → List<String>
The older top-level platform keys section still uses, for a note that they have moved under platforms:.
dvPageCspWithDocumentSlots(String policy, DVWebDocumentSlots slots, {String readFile(String path)?}) → String
policy allowing what slots load.
dvPlatformTargets(Object? platforms) → List<String>
The platforms a project says it builds for, from either shape of dartvel.platforms: the older list ([web, android]) or the map, whose keys are the platforms.
dvResolveDocumentSlots(DVWebDocumentSlots slots, {String readFile(String path)?}) → Map<DVDocumentSlot, String>
The HTML each slot resolves to: inline snippets as written, file snippets through readFile, in order.
dvWebFileProblem(String path) → String?
Why path cannot name a snippet file, or null when it can.
dvWithPlatforms(Map<Object?, Object?> section) → Map<Object?, Object?>
section, the dartvel: object, with each platform's settings readable at both homes: platforms.<name> and the older <name>.