mobileapplicationPassvault/lib/api_provider/sso_validation_provider.dart

49 lines
1.3 KiB
Dart
Raw Permalink Normal View History

2024-04-12 05:23:32 +00:00
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_passvault/constant/constantfile.dart';
import 'package:flutter_passvault/modelclasses/sso_validation_model.dart';
class SsoValidationProvider extends ChangeNotifier {
final dio = Dio();
Ssovalidationmodel? _serverResponse;
Ssovalidationmodel? get message => _serverResponse;
Future<void> ssovalidationrespose(
String name, String email, String device, String token) async {
final Map sendingregdara = {
"name": name,
"email": email,
"device": device,
"fcm_token": token
};
// final Map<String, dynamic> sendingregdara = {
// "name": "Laxman",
// "email": "laxmank@aissel.com",
// };
print("Form_data_is: $sendingregdara");
try {
final regResponse = await dio.post(
"${ApiConstants.newKonectarurl}/validate_sso",
data: sendingregdara);
// ignore: unrelated_type_equality_checks
if (regResponse.statusCode == 200) {
_serverResponse = Ssovalidationmodel.fromJson(regResponse.data);
print("server_resposeeeeeeeeeeeeee: $_serverResponse");
notifyListeners();
} else {
print('Failed : ${regResponse.statusCode}');
notifyListeners();
}
} catch (error) {
print('Failed : $error');
}
}
}