summaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers/radio_notifier.dart
blob: 90e0df5ffe86bca1107c23de1d58472ed62420dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import 'package:flutter_ics_homescreen/export.dart';

class RadioStateNotifier extends Notifier<RadioState> {
  @override
  RadioState build() {
    return RadioState.initial();
  }

  void updateBandParameters(
      {required int freqMin, required freqMax, required freqStep}) {
    state =
        state.copyWith(freqMin: freqMin, freqMax: freqMax, freqStep: freqStep);
  }

  void updateFrequency(int frequency) {
    state = state.copyWith(freqCurrent: frequency);
  }

  void setFrequency(int frequency) {
    state = state.copyWith(freqCurrent: frequency);
    ref.read(radioClientProvider).setFrequency(frequency);
  }

  void updatePlaying(bool playing) {
    state = state.copyWith(playing: playing);
  }

  void updateScanning(bool scanning) {
    state = state.copyWith(scanning: scanning);
  }
}