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
Copy file name to clipboardExpand all lines: README.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,6 +193,70 @@ You can also remove all dependencies all at once, i.e. when you log the user out
193
193
DI.session.unregisterAll();
194
194
```
195
195
196
+
## Step 9: Service Lifecycle Management
197
+
198
+
`df_di` includes base service classes with well-defined lifecycle states (init, pause, resume, dispose). These integrate seamlessly with the DI system.
199
+
200
+
| Class | Purpose |
201
+
|-------|---------|
202
+
|`Service`| Base service with init/pause/resume/dispose lifecycle |
203
+
|`StreamService<TData>`| Service that manages a data stream |
204
+
|`PollingStreamService<TData>`| StreamService that polls at regular intervals |
205
+
206
+
```dart
207
+
import 'package:df_di/df_di.dart';
208
+
209
+
/// A simple counter service with lifecycle management.
For Flutter apps that need to respond to app lifecycle events (pause when backgrounded, resume when foregrounded), use the `ObservedService` variants from [df_flutter_services](https://pub.dev/packages/df_flutter_services).
253
+
254
+
## Related Packages
255
+
256
+
-[df_flutter_services](https://pub.dev/packages/df_flutter_services) - Flutter-specific service classes with app lifecycle integration
257
+
-[df_pod](https://pub.dev/packages/df_pod) - Reactive state containers
Copy file name to clipboardExpand all lines: _README_CONTENT.md
+65-1Lines changed: 65 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,4 +176,68 @@ You can also remove all dependencies all at once, i.e. when you log the user out
176
176
```dart
177
177
// This will unregister all dependencies in the reverse order by which they were registered.
178
178
DI.session.unregisterAll();
179
-
```
179
+
```
180
+
181
+
## Step 9: Service Lifecycle Management
182
+
183
+
`df_di` includes base service classes with well-defined lifecycle states (init, pause, resume, dispose). These integrate seamlessly with the DI system.
184
+
185
+
| Class | Purpose |
186
+
|-------|---------|
187
+
|`Service`| Base service with init/pause/resume/dispose lifecycle |
188
+
|`StreamService<TData>`| Service that manages a data stream |
189
+
|`PollingStreamService<TData>`| StreamService that polls at regular intervals |
190
+
191
+
```dart
192
+
import 'package:df_di/df_di.dart';
193
+
194
+
/// A simple counter service with lifecycle management.
For Flutter apps that need to respond to app lifecycle events (pause when backgrounded, resume when foregrounded), use the `ObservedService` variants from [df_flutter_services](https://pub.dev/packages/df_flutter_services).
238
+
239
+
## Related Packages
240
+
241
+
-[df_flutter_services](https://pub.dev/packages/df_flutter_services) - Flutter-specific service classes with app lifecycle integration
242
+
-[df_pod](https://pub.dev/packages/df_pod) - Reactive state containers
0 commit comments