toJson method

Map<String, dynamic> toJson()

Converts the AccountData object to a JSON map.

This method is useful for serializing the object for API communication.

Example:

AccountData accountData = AccountData(
  firstName: "John",
  lastName: "Doe",
  routingNumber: "123456789",
  last4: "5678",
);
Map<String, dynamic> jsonData = accountData.toJson();

Implementation

Map<String, dynamic> toJson() {
  return {
    'first_name': firstName,
    'last_name': lastName,
    'routing_number': routingNumber,
    'last_4': last4,
  };
}