我有这个在我的应用程序中被正确调用的类。结构如下:
我不知道为什么他只是称我为两者之一,而不是他应该做的: Connection().pendingUnitRegistration
这个调用是正确的,但之后它没有发出 连接().units(
为什么?我该如何解决?我必须在 onValidate 中进行两次调用
EmailOtp(
onValidate: (otp) async {
var user =
await Connection().getUserInfo(id: "me");
if (user == null) {
Fluttertoast.showToast(
msg:
"Al momento non è possibile continuare la registrazione");
logger
.w("Merchant registration: user was null");
}
var valid =
await Connection().pendingUnitRegistration();
if (valid) {
Connection().units(
address: sedeLegale.address,
businessName: ragSoc,
// todo che fare nel (remoto) caso in cui sia null?
cap: sedeLegale.cap ?? "n/a",
categoryId: 2,
city: sedeLegale.city,
createdBy: user!.createdBy,
email: user.username,
firstName: user.firstName,
fiscalCode: user.fiscalCode,
fiscalRegime: regFis,
geoX:
sedeLegale.coords!.latitude.toString(),
geoY:
sedeLegale.coords!.longitude.toString(),
hasCustomInvoicing: true,
iban: "",
imageId: user.imageId,
isPA: true,
legalNature: natLeg,
otp: otp,
phone: user.phone,
province: sedeLegale.provence!,
recipientCode: codDes,
roleId: 2,
scopeId: 2,
statusId: 2,
storeName: sedeLegale.name,
unitOwnerId: 2,
vatNumber: iva);
}
return true;
},
onEnd: () =>
Get.to(() => TerminatedPage(finishPage: true)),
requestNewOtp: () async {
var data =
await Connection().getUserInfo(id: "me");
Connection().pendingRegistration(
email: data!.username,
phonePrefix: data.phone.substring(0, 3),
phoneNumber: data.phone.substring(3));
//TODO implement
},
)