You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
final products = RemoteItem.products.read; // [ProductModel(name: 'Product 1', price: 100.0)]
103
111
```
104
112
105
-
---
106
-
107
-
108
113
## Features
109
114
### Abstract Models
110
115
@@ -127,7 +132,6 @@ final products = RemoteItem.products.read; // [ProductModel(name: 'Product 1', p
127
132
128
133
-`IParsableService`: Provides a parsing mechanism for models, supporting single objects and lists.
129
134
130
-
---
131
135
132
136
## Model Definitions
133
137
@@ -137,16 +141,17 @@ You can use the ready-made models for `String`, `int`, `double`, and `bool`, or
137
141
138
142
### 2. Enums
139
143
144
+
First, the enum class to be parsed should inherit from the `IParsableEnum` interface. This interface should include a method that returns all values of the enum class. Then, using the `IParsableEnumModel` class, the enum class can be made parsable.
140
145
141
146
```dart
142
-
enum TestEnum with IParsableEnum<TestEnum> {
143
-
first,
144
-
second,
145
-
third,
147
+
enum AppTheme with IParsableEnum<AppTheme> {
148
+
system,
149
+
light,
150
+
dark,
146
151
;
147
-
152
+
148
153
@override
149
-
List<TestEnum> get enumValues => values;
154
+
List<AppTheme> get enumValues => values;
150
155
}
151
156
```
152
157
@@ -174,8 +179,6 @@ class ForceUpdateModel extends IParsableObjectModel<ForceUpdateModel> {
174
179
}
175
180
```
176
181
177
-
---
178
-
179
182
## Contributing
180
183
181
184
Contributions are welcome! Feel free to submit a pull request or open an issue to suggest improvements
0 commit comments