Skip to content

Commit

Permalink
Update the bloc
Browse files Browse the repository at this point in the history
  • Loading branch information
SepehrFakoori committed Jul 10, 2024
1 parent 8028036 commit 0e2a95a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/bloc/crypto/crypto_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import 'package:currency_exchange_rate_app_flutter/bloc/crypto/crypto_event.dart';
import 'package:currency_exchange_rate_app_flutter/bloc/crypto/crypto_state.dart';
import 'package:currency_exchange_rate_app_flutter/data/repository/crypto_currency_repository.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:bloc/bloc.dart';
import 'package:currency_exchange_rate_app_flutter/di/di.dart';

class CryptoBloc extends Bloc<CryptoEvent, CryptoState> {
final ICryptoCurrencyRepository _repository;
CryptoBloc(this._repository) : super(CryptoInitState()) {
final ICryptoCurrencyRepository _repository = locator.get();

CryptoBloc() : super(CryptoInitState()) {
on<CryptoInitializeEvent>((event, emit) async {
emit(CryptoLoadingState());
final response = await _repository.getCryptoCurrencies();
var response = await _repository.getCryptoCurrencies();
emit(CryptoResponseState(response));
});
}
Expand Down

0 comments on commit 0e2a95a

Please sign in to comment.