import 'package:dio/dio.dart'; import 'package:flutter_provider_demo/model/api.dart'; import 'package:flutter_provider_demo/model/user_model.dart'; class UserDao { Future login(String username, String pwd) async { Map params = {"username": username, "pwd": pwd}; Response response = await Dio().post( Api.login, data: params, ); return UserModel.fromJson(response.data); } Future logout(String token) async { Map params = {"token": token}; Response response = await Dio().post( Api.logout, data: params, ); return response.data["code"] == 200; } }