tapIdentifier method
Resolves a stable Semantics identifier and dispatches tap in one
admitted request.
Implementation
Future<PatchbayInvocation> tapIdentifier({
required String identifier,
int? expectedGeneration,
String? requestId,
}) {
final String id = requestId ?? _newRequestId();
if (identifier.isEmpty || (expectedGeneration ?? 0) < 0) {
return Future<PatchbayInvocation>.value(
PatchbayInvocation.rejected(
requestId: id,
rejection: PatchbayRejection(
code: 'invalidUiArguments',
notice: 'identifier must be non-empty and generation non-negative.',
details: <String, Object?>{
'identifier': identifier,
'expectedGeneration': ?expectedGeneration,
},
),
),
);
}
return _dispatch(
requestId: id,
action: PatchbaySemanticsAction.tap,
identifier: identifier,
resolve: (int? pinnedGeneration) => _resolver.byIdentifier(
identifier: identifier,
expectedGeneration: pinnedGeneration ?? expectedGeneration,
action: PatchbaySemanticsAction.tap,
),
);
}