deleteAccount static method

Future<bool> deleteAccount(
  1. String username
)

删除保存的账户

Implementation

static Future<bool> deleteAccount(String username) async {
  final Box<JunnyAccount>? accountBox = DatabaseUtils.accountBox;
  if (accountBox == null) {
    return false;
  }

  final Query<JunnyAccount> query =
      accountBox.query(JunnyAccount_.username.equals(username)).build();
  final JunnyAccount? account = query.findFirst();
  query.close();

  if (account != null) {
    return accountBox.remove(account.localDbId);
  }
  return false;
}