๐ขCollection data
Management of collection data such as List, Set, Map.
Usage
Pulse-X has provided you with three different collection view models. You can use each of them as you need.
PulseXListViewModel
PulseXSetViewModel
PulseXMapViewModel
Example 1 - PulseXListViewModel
Let's create a random user list generator using Pulse.
Create a UserModel class to create user model.
class UserModel {
String name;
String age;
String job;
String city;
UserModel({
required this.name,
required this.age,
required this.job,
required this.city,
});
}Then, create a service that returns a new user. Here, I'll use abstraction to obey Open/Close Principle.
After that, you are ready to create a ViewModel which extends Pulse's PulseListViewModel. We'll pass IUserService in constructor to do dependency inversion.
Lastly, we'll have to create a view that shows a list of users.
๐พCongratulations!! You've completed list data management with Pulse.
Complete source code can be found here. https://github.com/YeLwinOo-Steve/rand_user
๐ง Set and map management examples are coming soon .....
Last updated