updateAccountInfo function

Future<AccountInfo> updateAccountInfo(
  1. int? accountInfoId,
  2. String personInChargeName,
  3. String phoneNumber,
  4. String vendorEmail,
  5. String isPublished,
)

Implementation

Future<AccountInfo> updateAccountInfo(
    int? accountInfoId,
    String personInChargeName,
    String phoneNumber,
    String vendorEmail,
    //String selectedBusinessCate,
    String isPublished) async {
  HttpOverrides.global = new MyHttpOverrides();
  final response = await http.put(
    //Uri.parse('https://172.30.1.10:45455/api/AccountInfoModels/$accountInfoId'),
    Uri.parse(
        'https://192.168.1.106:45455/api/AccountInfoModels/$accountInfoId'),

    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: jsonEncode(<String, String>{
      'accountInfoId': accountInfoId.toString(),
      'personInChargeName': personInChargeName,
      'phoneNumber': phoneNumber,
      'vendorEmail': vendorEmail,
      //  'selectedBusinessCate': selectedBusinessCate,
      'isPublished': isPublished,
    }),
  );

  if (response.statusCode == 200) {
    // If the server did return a 200 CREATED response,
    // then parse the JSON.
    return AccountInfo.fromJson(jsonDecode(response.body));
  } else {
    // If the server did not return a 200 CREATED response,
    // then throw an exception.
    throw Exception('Failed to create service.');
  }
}