copyWith method

PaymayaShippingAddress copyWith({
  1. String? phone,
  2. String? email,
  3. ShippingType? shippingType,
  4. String? firstName,
  5. String? lastName,
  6. String? middleName,
  7. String? line1,
  8. String? line2,
  9. String? city,
  10. String? state,
  11. String? zipCode,
  12. String? countryCode,
})

Example: Extended class of PaymayaBillingAddress.

final shippingAddress = PaymayaShippingAddress(
  phone:'09123456789',
  email:'paymaya@flutter.com',
  shippingType: Shippingtype.st, // Standard
  firstName: 'John'
  middleName: 'Birb',
  lastName: 'Doe',
  line1: '123-4567',
  line2: '456-789',
  city: 'Davao City',
  state: 'Davao del Sur',
  zipCode: 8000,
  countryCode: 'PH', /// Default value is set to 'PH'
);

Implementation

PaymayaShippingAddress copyWith({
  String? phone,
  String? email,
  ShippingType? shippingType,
  String? firstName,
  String? lastName,
  String? middleName,
  String? line1,
  String? line2,
  String? city,
  String? state,
  String? zipCode,
  String? countryCode,
}) {
  return PaymayaShippingAddress(
    phone: phone ?? this.phone,
    email: email ?? this.email,
    shippingType: shippingType ?? this.shippingType,
    firstName: firstName ?? this.firstName,
    lastName: lastName ?? this.lastName,
    middleName: middleName ?? this.middleName,
    line1: line1 ?? this.line1,
    line2: line2 ?? this.line2,
    city: city ?? this.city,
    state: state ?? this.state,
    zipCode: zipCode ?? this.zipCode,
    countryCode: countryCode ?? this.countryCode,
  );
}