It would be nice to be able to piggy back on the lifecycle of a StatefulWidget's state for handling the StatefulIsolate, like SingleTickerProviderStateMixin.
Describe the solution you'd like
Attaching a mixin on your StatefulWidget's state that creates and holds an Isolate and exposes it for running work on the isolate.
This mixin would handle lifecycle piggybacking on the State's initState and dispose functions.
Additional context
Naming is hard, the names I have come up with so far are probably not good for different reasons.
- Reusing the name
StatefulIsolate will probably end up in confusion, if even possible to implement.
- Just use
Isolate would look nice (class _MyWidgetState extends StatefulWidget<MyWidget> with Isolate) but would clash with the Isolate class from Dart.
It would be nice to be able to piggy back on the lifecycle of a
StatefulWidget's state for handling theStatefulIsolate, likeSingleTickerProviderStateMixin.Describe the solution you'd like
Attaching a mixin on your
StatefulWidget's state that creates and holds an Isolate and exposes it for running work on the isolate.This mixin would handle lifecycle piggybacking on the
State'sinitStateanddisposefunctions.Additional context
Naming is hard, the names I have come up with so far are probably not good for different reasons.
StatefulIsolatewill probably end up in confusion, if even possible to implement.Isolatewould look nice (class _MyWidgetState extends StatefulWidget<MyWidget> with Isolate) but would clash with theIsolateclass from Dart.