getUserInformation method
Implementation
@override
Future<Map<String, dynamic>> getUserInformation(String cameraId) async {
// if (isRequestPending) {
// return {
// "isError": true,
// "message": "PENDING_PREVIOUS_REQUEST",
// "details": "Called getUserInformation()"
// };
// }
try {
// isRequestPending = true;
final apiResponse = await apiService.getDeviceMasterAccount(cameraId);
if (apiResponse['isError']) return apiResponse;
final account = apiResponse["account"];
await methodChannel.invokeMethod('LOGIN', {
"userName": account["username"],
"password": account["password"],
});
final va = await methodChannel.invokeMethod('GET_USER_INFO');
Map<String, dynamic> jsonData = json.decode(va[0]);
return {
"isError": false,
"details": jsonData["data"],
};
} catch (e) {
// isRequestPending = false;
if (e is PlatformException) {
return {"isError": true, "message": e.message};
}
return {"isError": true, "message": "Error: $e"};
}
}