Dart 7+ years in Mobile Application Development Core Member of Flutter Karachi Pakistan Women in Tech Speaker for Google Developers Space, Singapore Mentor in various Google programs
Collection for all users (players) 3. Periodically update position of the player @override void update(double dt) { if (checkInterval( 'updatePlayerPosition' , 1000, dt)) { print('updatePlayerPosition triggered'); if (gameRef.player != null) { _dbService.updatePlayerPosition( gameRef.player!.position.x, gameRef.player!.position.y); } } }
Collection for all users (players) 3. Periodically update position of the player 4. Get players’ live locations via StreamSubscription BonfireWidget( joystick: joystick, player: Dash( Vector2(2 * tileSize, 3 * tileSize), uid: widget.uid, ), components: [gameController], interface: DashInterface(), onReady: (interface) { _subscribeToPlayersStream(); }, … }
check if the component exists in the game 3. If it doesn’t exist, add the component to the game 4. If it already exists, update this component’s position if (user.uid != widget.uid) { // Find the opponent component with the corresponding playerId try { var opponentDash = gameController .opponents.firstWhere( (opponent) => opponent. uid == user.uid, ); gameController .updatePlayerPosition( opponentDash , Vector2(user.positionX!,user.positionY)) ; } catch (e) { gameController .addPlayer( Dash( Vector2(user.positionX!, user.positionY!),uid: user.uid, ), ); }
state management ✅ Blank canvas -> high customisation ✅ Lightweight game ✅ Performant ✅ Quick to create ✅ Developer Friendly!! ❌ No need to learn complex engines like Unity to build a simple game