- provides the logic and game-management layer to build shut the box games upon
add shut_the_box_engine
to your pubspec.yaml
this packages provides a gameProvider
which can be used in provider patterns to access all stuff needed.
let intellij show you the rest.
This is how you would create a Counter app (thats not what this package is about lol):
import 'package:shut_the_box_engine/shut_the_box_engine.dart' as E;
class GameView extends ConsumerWidget {
final _gamep = E.gameProvider(E.Game());
@override
Widget build(BuildContext context, WidgetRef ref) {
final gamep = ref.watch(_gamep); //.game;
return Scaffold(
body: Center(
child: Text(gamep.game.players.length.toString()),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
ref.read(_gamep).addPlayers([E.Player()]);
},
),
);
}
}
for an example see here