32 lines
1008 B
Dart
32 lines
1008 B
Dart
import 'dart:async';
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import '../product/services/api_services.dart';
|
|
import '../feature/settings/profile/profile_model.dart';
|
|
import '../product/base/bloc/base_bloc.dart';
|
|
|
|
class SettingsBloc extends BlocBase {
|
|
// Settings Screen
|
|
APIServices apiServices = APIServices();
|
|
final userProfile = StreamController<User>.broadcast();
|
|
StreamSink<User> get sinkUserProfile => userProfile.sink;
|
|
Stream<User> get streamUserProfile => userProfile.stream;
|
|
|
|
// Profile Screen
|
|
final isChangeProfileInfomation = StreamController<bool>.broadcast();
|
|
StreamSink<bool> get sinkIsChangeProfileInfomation =>
|
|
isChangeProfileInfomation.sink;
|
|
Stream<bool> get streamIsChangeProfileInfomation =>
|
|
isChangeProfileInfomation.stream;
|
|
|
|
void getUserProfile(BuildContext context) async {
|
|
await apiServices.execute(context, () async {
|
|
User user = await apiServices.getUserDetail();
|
|
sinkUserProfile.add(user);
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {}
|
|
}
|