user_dao.dart 436 B

1234567891011121314
  1. import 'package:dio/dio.dart';
  2. import 'package:flutter_provider_demo/model/api.dart';
  3. import 'package:flutter_provider_demo/model/user_model.dart';
  4. class UserDao {
  5. Future<UserModel> login(String username, String pwd) async {
  6. Map<String, dynamic> params = {"username": username, "pwd": pwd};
  7. Response response = await Dio().post(
  8. Api.login,
  9. data: params,
  10. );
  11. return UserModel.fromJson(response.data);
  12. }
  13. }