aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers/radio_notifier.dart
blob: 3ef4da414637f17ae851667d1cfd1b2f50980290 (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 const 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);
  }
}