import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:recording_tool/core/network/network_monitor.dart';
import 'package:recording_tool/core/network/network_state.dart';

final networkMonitorProvider = Provider<NetworkMonitor>((ref) {
  final monitor = NetworkMonitor()..start();
  ref.onDispose(monitor.dispose);
  return monitor;
});

final networkStateProvider = StreamProvider<NetworkState>((ref) {
  final monitor = ref.watch(networkMonitorProvider);
  return monitor.stream;
});
