I am doing a tutorial on BLoC in Flutter and the tutor uses the keyword "is" in his conditional if statement, which he said "smartcasts" the state. Can anyone help me understand how the "is" operator gives me access to the bloc's state in the code below?
BlocBuilder<WeatherBloc, WeatherState>(
builder: (context, state) {
if (state is WeatherLoaded) {
return buildColumnWithData(context,state.weather);
}
When I tried the same code with if (state == WeatherLoaded), I'm not able to pass the state.weather into the buildColumnWithData function. Why is this?