title: Expert State Management advice needed
body: <p>I'm using the Provider package to push data and make changes to the state through the data which changes inside this. My app uses Bluetooth and USB Serial connections since it manages IoT devices.</p>
  <p>Here is the main.dart file:</p>
  <pre><code>void main() async {
    WidgetsFlutterBinding.ensureInitialized();
    SystemChrome.setEnabledSystemUIOverlays([]);
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ]);
    await Firebase.initializeApp();
  
    final _ble = FlutterReactiveBle();
    final _scanner = BleScanner(_ble);
    final _monitor = BleStatusMonitor(_ble);
    final _connector = BleDeviceConnector(_ble);
  
    runApp(
      MultiProvider(
        providers: [
          ChangeNotifierProvider(create: (_) =&gt; USBManager()),
          StreamProvider&lt;User&gt;.value(
            value: AuthService().user,
          ),
          Provider.value(value: _scanner),
          Provider.value(value: _monitor),
          Provider.value(value: _connector),
          StreamProvider&lt;BleScannerState&gt;(
            create: (_) =&gt; _scanner.state,
            initialData: const BleScannerState(
              discoveredDevices: [],
              scanIsInProgress: false,
            ),
          ),
          StreamProvider&lt;BleStatus&gt;(
            create: (_) =&gt; _monitor.state,
            initialData: BleStatus.unknown,
          ),
          StreamProvider&lt;ConnectionStateUpdate&gt;(
            create: (_) =&gt; _connector.state,
            initialData: const ConnectionStateUpdate(
              deviceId: 'Unknown device',
              connectionState: DeviceConnectionState.disconnected,
              failure: null,
            ),
          ),
        ],
        child: MaterialApp(
          debugShowCheckedModeBanner: false,
          navigatorObservers: [
            FirebaseAnalyticsObserver(analytics: FirebaseAnalytics()),
          ],
          routes: {
            '/': (context) =&gt; RegisterScreen(),
            '/navBar': (context) =&gt; AppBottomNav(),
            '/scan': (context) =&gt; ScanScreen(),
          },
          theme: ThemeData(
              bottomAppBarTheme: BottomAppBarTheme(
                color: Colors.green[400],
              ),
              brightness: Brightness.dark,
              primarySwatch: Colors.green,
              visualDensity: VisualDensity.adaptivePlatformDensity),
        ),
      ),
    );
  }
  </code></pre>
  <p>As you can see, there are many streams that need to be listened to simultaneously to:</p>
  <ol>
  <li>Detect BLE status (on/off/permissions etc.)</li>
  <li>Device connection status (BLE)</li>
  <li>Device connection status (USB)</li>
  <li>Firebase User</li>
  </ol>
  <p>In addition to this, I want to prevent the user from accessing certain pages of the app if the connection gets abruptly disconnected and many other state changes.</p>
  <p>My Question: Since there are so many instances of so many classes running and I want to access the active instances of the classes to read streams and make the classes interact with each other (detect sudden disconnects, successful connection and much more, which will make a change in the changenotifier and update the UI), is provider the best solution? Should I run all the device connection instances in one Change Notifier provider and access that only to make the work easier?</p>
  <p><strong>Is there a way of making multiple providers interact with each other?</strong></p>
  <p>Thanks in advance</p>