stanbic method

Future<Map<String, dynamic>> stanbic(
  1. String username,
  2. String password,
  3. String publicKey,
  4. String orgId,
)

Implementation

Future<Map<String, dynamic>> stanbic(
    String username, String password, String publicKey, String orgId) async {
  var result;

  notifyListeners();

  final Map<String, dynamic> inputData = {
    "username": username,
    "password": password,
    "publicKey":publicKey,
    "orgId":orgId
  };

  var headers = {'Content-Type': 'application/json'};



  var request = http.Request(
    'POST',
    Uri.parse(AppUrl.stanbic),
  );
  request.body = json.encode(inputData);
  request.headers.addAll(headers);

  http.StreamedResponse streamedResponse = await request.send();
  final response = await http.Response.fromStream(streamedResponse);

  final Map<String, dynamic> responseData = json.decode(response.body);


  if (response.statusCode == 200) {



    result = {
        'status': true,
        'message': responseData['message'] ?? responseData['msg'] ?? responseData['desc'] ,
        'data': responseData['account'] ?? responseData['data'],
        'otp' : responseData['otp']
      };

  } else {

    result = {
      'status': false,
      'message': responseData['message'] ?? responseData['msg'] ?? responseData['desc']
    };
  }

  return result;
}