After I updated the code to adapt flutter null safety the code below gaves me the error
The getter 'value' isn't defined for the type 'BehaviorSubject'.
final _brightness = BehaviorSubject<Brightness>();
...
if (_brightness.value == Brightness.light) { ... } // error is here
How to get value from BehaviorSubject then?
Using rxdart: ^0.26.0
The Code you provided reads like you want to get the value from a Brightness Instance which is stored in the BehaviorSubject.
https://pub.dev/documentation/rxdart/latest/rx/BehaviorSubject-class.html
Your _brightness variable is not from type Brightness its of type BehaviorSubject. So you have to subscribe with a listener to it and you will get the latest value which has been added to the BehaviorSubject.