Courses

[NEW] Flutter 3 Mobile App with Laravel 12 API

Adding Another CRUD - Transactions

You're reading a FREE PREVIEW of a PREMIUM course.

In this lesson, we will apply all the things we have learned in the previous lesson and build a Transactions CRUD screen:


Creating a Model

Let's start by creating our new Transaction Model to match our Laravel Model and Database fields:

lib/models/transaction.dart

class Transaction {
int id;
int categoryId;
String categoryName;
String description;
String amount;
String transactionDate;
String createdAt;
 
Transaction(
{required this.id,
required this.categoryId,
required this.categoryName,
required this.description,
required this.amount,
required this.transactionDate,
required this.createdAt});
 
factory Transaction.fromJson(Map<String, dynamic> json) {
return Transaction(
id: json['id'],
categoryId: json['category_id'],
categoryName: json['category_name'],
description: json['description'],
amount: json['amount'],
transactionDate: json['transaction_date'],
createdAt: json['created_at'],
);
}
}

Adding API Functions

Next, we need to add...

The full lesson is only for Premium Members.
Want to access all 26 lessons of this course? (115 min read)

You also get:

  • 75 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord