initiateSession method

void initiateSession(
  1. Map<String, dynamic> params
)

Use this function to launch the Attestr flow params Should contain hs, cl, lc, retry and qr

Implementation

void initiateSession(Map<String, dynamic> params) async {
  try {
    Map<dynamic, dynamic> validationParameters = _validateParameters(params);
    if (!validationParameters['success']) {
      Map<dynamic, dynamic> exceptionMap = {
        'type': _CODE_FLOW_ERROR,
        'message': {
          'code': _INVALID_PARAMETERS,
          'message': "Invalid parameters hs & cl "
        }
      };
      _handleResult(exceptionMap);
      return;
    }
    var result = await platform.invokeMethod('initiateSession', params);
    _handleResult(result);
  } on PlatformException catch (e) {
    print("PlatformException: ${e.toString()}");
    Map<dynamic, dynamic> exceptionMap = {
      'type': _CODE_FLOW_ERROR,
      'message': {
        'code': 5001,
        'httpStatusCode': 500,
        'message': "Request could not be processed"
      }
    };
    _handleResult(exceptionMap);
  }
}