socialLogin method Null safety

  1. @override
Future<SocialLoginUserModel> socialLogin(
  1. {required SocialLoginUserModel socialLoginUserModel}
)
override

It's used to make login with social.

SocialType: Facebook=1, Twitter=2, Apple Id=7, Instgram=3

You should pass the id that returns from social authentication to SocialCode.

Implementation

@override
Future<SocialLoginUserModel> socialLogin(
    {required SocialLoginUserModel socialLoginUserModel}) async {
  final response =
      await postData(path: 'social/Login', data: socialLoginUserModel);
  final result = ApiReturnResult.fromJSON(response.data);
  if (result.code == 200) {
    return SocialLoginUserModel.fromJson(result.data);
  } else {
    throw ExceptionApi(code: result.code, message: result.error?.first);
  }
}