updateToken method Null safety

  1. @override
Future updateToken(
  1. AuthServer server,
  2. String? oldAccessToken,
  3. String? newAccessToken,
  4. DateTime? newIssueDate,
  5. DateTime? newExpirationDate
)
override

Must update AuthToken with [newAccessToken, [newIssueDate, newExpirationDate.

This method must must update an existing AuthToken, found by oldAccessToken, with the values newAccessToken, newIssueDate and newExpirationDate.

You may alter the token in addition to the provided values, and you may override the provided values. newAccessToken defaults to a random 32 character string.

Implementation

@override
Future updateToken(
  AuthServer server,
  String? oldAccessToken,
  String? newAccessToken,
  DateTime? newIssueDate,
  DateTime? newExpirationDate,
) {
  final query = Query<ManagedAuthToken>(context!)
    ..where((o) => o.accessToken).equalTo(oldAccessToken)
    ..values.accessToken = newAccessToken
    ..values.issueDate = newIssueDate
    ..values.expirationDate = newExpirationDate;

  return query.updateOne();
}