TilesTokenSource class

Giữ một tiles token cho cả phiên và làm mới khi cần.

Mọi lỗi đều xuống thang êm: không có token thì request tile vẫn đi, chỉ là được phục vụ ở tầng miễn phí. Bản đồ không bao giờ bị chặn vì token.

Constructors

TilesTokenSource({required String tokenUrl, String service = 'tiles', String? apiKey, String? secretKey, Client? httpClient, DateTime now()?, TilesTokenSigner? signer})

Properties

apiKey → String?
final
hashCode → int
The hash code for this object.
no setterinherited
refreshAt → DateTime?
Mốc nên làm mới — 90% TTL kể từ lúc lấy được token.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
secretKey → String?
final
service → String
Service của nguồn này — quyết định endpoint mặc định và host được đính token.
final
tokenUrl → String
final

Methods

close() → void
Đóng http client nếu client đó do chính nguồn này tạo ra.
current() → String?
Token dùng được ngay lúc này, hoặc null.
invalidate() → void
Bỏ token đang giữ, buộc lần sau phải lấy mới.
needsRefresh() → bool
true khi đã quá mốc 90% TTL, hoặc chưa có token nào.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyTileError(int? status) → Future<void>
Lưới an toàn khi tile bị edge từ chối.
refresh() → Future<String?>
Lấy token mới. Không bao giờ ném lỗi; thất bại thì trả null.
toString() → String
A string representation of this object.
inherited

Operators

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