updateMyProfile method

  1. @override
Future<void> updateMyProfile(
  1. String name,
  2. String? email,
  3. String? mobile,
  4. String? status,
  5. String? image,
  6. dynamic callback(
    1. FlyResponse response
    )?,
)
override

This method is used to update the current user profile.

Implementation

@override
Future<void> updateMyProfile(
    String name,
    String? email,
    String? mobile,
    String? status,
    String? image,
    Function(FlyResponse response)? callback) async {
  //updateProfile
  String? profileResponse;
  try {
    profileResponse = await mirrorFlyMethodChannel.invokeMethod(
        'updateMyProfile', {
      "name": name,
      "email": email,
      "mobile": mobile,
      "status": status,
      "image": image
    });
    var res = convertProfileUpdateJsonFromString(profileResponse);
    callback?.call(FlyResponse(true, res, "user profile updated"));
  } on PlatformException catch (e) {
    LogMessage.d("Platform Exception =", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(e.code, e.message, e.details)));
  } on Exception catch (e) {
    LogMessage.d("Exception ", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
  }
}