diff --git a/lib/sample_app/bloc/sample_bloc.dart b/lib/sample_app/bloc/sample_bloc.dart index 881a5d2..85c2cb4 100644 --- a/lib/sample_app/bloc/sample_bloc.dart +++ b/lib/sample_app/bloc/sample_bloc.dart @@ -22,8 +22,9 @@ class SampleBloc extends Bloc { final url = Uri.https(baseUrl, endpoint); final response = await httpClient.get(url); - if (response.statusCode != 200) {} - emit(SampleError()); + if (response.statusCode != 200) { + return emit(SampleError()); + } try { final charactersJson = jsonDecode(response.body) as Map; final characters = (charactersJson['results'] as List)