36 lines
805 B
Dart
36 lines
805 B
Dart
import 'dart:async';
|
|
|
|
import 'package:imagini/core/ImaginiApplication.dart';
|
|
import 'package:imagini/api/ImaginiAPIRepository.dart';
|
|
|
|
import 'package:imagini/models/api/response/LoginResponse.dart';
|
|
|
|
class SplashBloc{
|
|
|
|
final ImaginiApplication _application;
|
|
|
|
final _loginController = StreamController<LoginResponse>();
|
|
Stream<LoginResponse> get loginResult => _loginController.stream;
|
|
|
|
SplashBloc(this._application){
|
|
_init();
|
|
}
|
|
|
|
void _init(){
|
|
// Do Initial Load
|
|
initializeLogin();
|
|
}
|
|
|
|
void dispose(){
|
|
_loginController.close();
|
|
}
|
|
|
|
initializeLogin(){
|
|
ImaginiAPIRepository imaginiAPI = _application.imaginiAPI;
|
|
_loginController.addStream(imaginiAPI.login("admin", "admin2"));
|
|
|
|
// imaginiAPI.login("admin", "admin1").listen((LoginResponse lr) {
|
|
// });
|
|
}
|
|
}
|