Split AspectContainer out into separate package?
mikelnrd opened this issue · 2 comments
Hi. Would you please consider releasing AspectContainer
as a separate package?
More info
Just watched the Google I/O Pragmatic State Management talk (really great by the way!) and came here to look through the code and learn more about using package:provider
for state management. The talk mentioned that you can provide anything with package:provider
. It's really interesting that instead of providing ChangeNotifier
this app is providing AspectContainer
.
My question is: do you think the community would benefit from having AspectContainer
as a separate package?
I imagine 'heavily interdependent changing all the time game-simulation-like' state is needed in other apps. The released package could link to developer_quest as an example of how to use the package.
For anyone coming to this that wants to look into AspectContainer
:
See usage here:
https://github.com/2d-inc/developer_quest/blob/master/lib/src/shared_state/game/world.dart#L14
@filiph 's pull request:
fcd5382#diff-39e5cc7bb8c3938d1bb45de6cd3a76af
What is it all about?
/// An aspect of the game world that can be listened to.
///
/// This is like a [ChangeNotifier], but it uses the concept of dirtiness.
///
/// This is a very game-centric approach, geared toward state that is heavily
/// interdependent (like in a game simulation) and that is changed all the time
/// (again, like in a game simulation). You probably do not need this
/// for a regular app. Use regular [ChangeNotifier], which is cleaner.
Sources here:
https://github.com/2d-inc/developer_quest/tree/master/lib/src/shared_state/game/src
https://github.com/2d-inc/developer_quest/blob/master/lib/src/shared_state/game/src/aspect_container.dart
https://github.com/2d-inc/developer_quest/blob/master/lib/src/shared_state/game/src/child_aspect.dart
Hi @MikeLeonard, thanks for the suggestion! I'm personally not inclined to release this as a separate package. AspectContainer
is useful for this particular use case (a game running inside an app) but I don't think it's a good suggestion for regular apps. It promotes interdependence of classes (through ChildAspect.get
), which is unavoidable in most game code, but avoidable (and undesirable) in app code.
That said, if you feel strongly that this should be a package, feel free to release it.
cc @luigi-rosso We should add a LICENSE here. Otherwise the code is technically not open source.
Hi @filiph. Fair enough I trust your judgement on this one!
If I find a use case in the future (like you said... likely for a game running inside an app) I'll let you know and perhaps turn it into a package. I don't have a use case at the moment... it was more of just a fly-by suggestion for you.
Thanks for quick reply and the great state management talk :)