MiniProgramPublisherBackendContract constructor
MiniProgramPublisherBackendContract({})
Creates a provider-neutral Publisher API contract.
Implementation
MiniProgramPublisherBackendContract({
this.schemaVersion = currentSchemaVersion,
this.contractVersion = currentContractVersion,
required String appId,
required Uri backendBaseUri,
String healthEndpoint = defaultHealthEndpoint,
List<MiniProgramPublisherBackendSmokeCase>? smokeTests,
bool allowLocalHttp = false,
}) : appId = _normalizeAppId(appId),
backendBaseUri = _normalizeBackendBaseUri(
backendBaseUri,
allowLocalHttp: allowLocalHttp,
),
healthEndpoint = _normalizeRelativeEndpoint(
healthEndpoint,
'healthEndpoint',
),
smokeTests = List.unmodifiable(
_normalizeSmokeTests(smokeTests, healthEndpoint: healthEndpoint),
) {
if (schemaVersion != currentSchemaVersion) {
throw FormatException(
'Unsupported Publisher API contract schemaVersion: '
'$schemaVersion.',
);
}
if (contractVersion.trim() != currentContractVersion) {
throw FormatException(
'Unsupported Publisher API contractVersion: $contractVersion.',
);
}
}