DeviceBindingGenerateOTP method
Implementation
DeviceBindingGenerateOTP(BuildContext context) async {
authrepository auth = authrepository();
Map<String, dynamic> requestBody = {
"Statement": "GenerateOTP",
"EntityID": kglobal.shared.EntityID,
"MobileNumber": kglobal.shared.mobileNum,
"Purpose": 'DeviceBinding',
"DeviceID": kglobal.shared.deviceID,
"GeoLocation": kglobal.shared.geolocation,
};
String bodyJson = jsonEncode(requestBody);
// ✅ await instead of .then()
final value = await auth.DevicebindingGenerateOTP(context, bodyJson);
if (!context.mounted) return;
if (value.responseCode?.length == 4) {
kglobal.shared.OTPRefID = value.oTPRefID!;
} else {
kglobal.shared.showSnack(context, true, value.message ?? "");
Navigator.pop(context, {"message": value.message});
}
}