KeyMatcher class abstract

Resolves a typed API-key prefix (or full raw key) against an already-fetched key list. Pure — no Dio, no I/O — so logout and keys revoke can share one normalisation without either owning an HTTP call.

Normalisation, in order:

  1. Prepend appflight_ when the typed text doesn't already start with it — so both a3f9x1 and appflight_a3f9x1 work.
  2. Truncate to 16 characters — the server's stored prefix is exactly raw.slice(0, 16), so pasting a full raw key also resolves.
  3. Reject anything that carries no characters beyond appflight_ itself — an empty, whitespace, or appflight_-only typed value would otherwise be a prefix of every key and match all of them. That matters beyond keys revoke appflight_ reading as ambiguous: logout's legacy fallback passes a stored apiKey through unmodified when it's under 16 characters, and an empty or corrupted stored key must resolve to "no match", never to an unrelated live key.
  4. Match every key whose prefix starts with the normalised text — callers decide what zero, one, or many matches means.

Constructors

KeyMatcher()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

resolve(List<Map<String, dynamic>> keys, String typed) → List<Map<String, dynamic>>