when method
Determines whether the current Brightness matches the specified brightness.
Returns true if the Brightness obtained from the context matches the
brightness associated with this variant, and false otherwise.
Implementation
@override
bool when(BuildContext context) {
return Theme.of(context).brightness == brightness;
}