Created
June 9, 2019 13:56
-
-
Save guilhermecarvalhocarneiro/5de2c178dce19fbe7dfbb8763b994441 to your computer and use it in GitHub Desktop.
BloC da Class Roteiro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RoteiroBloc { | |
final _controller = StreamController(); | |
// Criando a Stream para retornar para quem chamou | |
get stream => _controller.stream; | |
// Método para consultar os roteiros da cidade. | |
getRoteiros(){ | |
Future future = Roteiro.getRoteiros(); | |
future.then((roteiros){ | |
_controller.sink.add(roteiros); | |
}); | |
} | |
// Método para detalhar o Roteiro | |
detailRoteiro(int id){ | |
Future future = Roteiro.detailRoteiro(id); | |
future.then((destino){ | |
_controller.sink.add(destino); | |
}); | |
} | |
close(){ | |
_controller.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment