Skip to content

Commit

Permalink
custom lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Happy0 committed Jul 4, 2024
1 parent 3606fe8 commit 4e9a5a2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/src/model/game/chat_presets_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ part 'chat_presets_controller.g.dart';

@riverpod
class ChatPresetsController extends _$ChatPresetsController {
late GameFullId gameId;
late GameFullId _gameId;

static const Map<PresetMessageGroup, List<PresetMessage>> presetMessages = {
static const Map<PresetMessageGroup, List<PresetMessage>> _presetMessages = {
PresetMessageGroup.start: [
(label: 'HI', value: 'Hello'),
(label: 'GL', value: 'Good luck'),
Expand All @@ -30,30 +30,29 @@ class ChatPresetsController extends _$ChatPresetsController {

@override
Future<ChatPresetsState> build(GameFullId id) async {
gameId = id;
_gameId = id;

final gameCtrlProvider = gameControllerProvider(gameId);
final gameState = ref.read(gameCtrlProvider).value;
final gameState = ref.read(gameControllerProvider(_gameId)).value;

ref.listen(gameCtrlProvider, _handleGameStateChange);
ref.listen(gameControllerProvider(_gameId), _handleGameStateChange);

if (gameState != null) {
final presetMessageGroup = PresetMessageGroup.fromGame(gameState.game);

const List<PresetMessage> alreadySaid = [];

final initialState = ChatPresetsState(
presets: presetMessages,
gameId: gameId,
presets: _presetMessages,
gameId: _gameId,
alreadySaid: alreadySaid,
currentPresetMessageGroup: presetMessageGroup,
);

return initialState;
} else {
return ChatPresetsState(
presets: presetMessages,
gameId: gameId,
presets: _presetMessages,
gameId: _gameId,
alreadySaid: [],
currentPresetMessageGroup: null,
);
Expand Down

0 comments on commit 4e9a5a2

Please sign in to comment.