import 'package:gobang/model/user_model.dart'; /// Description: user dao /// Time : 02/20/2024 Tuesday /// Author : liuyuqi.gov@msn.cn class UserDao { /// login /// @param username /// @param password /// @return Future static Future login(String username, String password) async { await Future.delayed(Duration(seconds: 2)); if (username == 'admin' && password == 'admin') { return UserModel.fromJson({"username": "admin", "password": "admin"}); } else { throw Exception('username or password is incorrect'); } } /// logout static Future logout() async { await Future.delayed(Duration(seconds: 2)); return true; } /// register /// @param username /// @param password /// @return Future static Future register(String username, String password) async { await Future.delayed(Duration(seconds: 2)); return 'success'; } }