Flutter-Buddies / tic_tac_no

Complex variants of tic-tac-toe game
MIT License
19 stars 10 forks source link

draw doesn't work #24

Closed slovnicki closed 3 years ago

slovnicki commented 3 years ago

Screenshot_1610215271

slovnicki commented 3 years ago

Oh, yeah, I think this answers the question

//? does this null aware opertor work here?
'${state.winner.name ?? 'Nobody'}'

it should probably be ${state.winner?.name ?? 'Nobody'}

════════ Exception caught by widgets library ═══════════════════════════════════
The following NoSuchMethodError was thrown building BlocBuilder<GameBloc, GameState>(dirty, state: _BlocBuilderBaseState<GameBloc, GameState>#148b3):
The getter 'name' was called on null.
Receiver: null
Tried calling: name

The relevant error-causing widget was
BlocBuilder<GameBloc, GameState>
package:tic_tac_no/…/ui/game_screen.dart:72
When the exception was thrown, this was the stack
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1      GameScreenState.build.<anonymous closure>
package:tic_tac_no/…/ui/game_screen.dart:81
#2      BlocBuilder.build
package:flutter_bloc/src/bloc_builder.dart:93
#3      _BlocBuilderBaseState.build
package:flutter_bloc/src/bloc_builder.dart:153
#4      StatefulElement.build
package:flutter/…/widgets/framework.dart:4801
...
slovnicki commented 3 years ago

Oh, and it seems that confetti is also running on draw. Maybe it would be better it didn't :)

Zambrella commented 3 years ago
Screenshot 2021-01-13 at 16 42 19

Fixed. No confetti too. Took way to long to synthesise a draw :P

Zambrella commented 3 years ago

Fixed in latest commit