Real Time Data change between two activity in Flutter Bloc pattern
up vote
0
down vote
favorite
I have two Activity.
Activity 1 ------> Text
Activity 2 ------> Increment Button
When user click on Activity 2 button then in Activity 1 Text Field will increment like counter.
My Current Bloc class:
class IncrementBloc implements BlocBase {
int _counter;
StreamController<int> _counterController = StreamController<int>();
Sink<int> get _inAdd => _counterController.sink;
Stream<int> get outCounter => _counterController.stream;
StreamController _actionController = StreamController();
Sink get incrementCounter => _actionController.sink;
IncrementBloc(){
_counter = 0;
_actionController.stream.listen(_handleLogic);
}
@override
void dispose() {
_actionController.close();
_counterController.close();
}
void _handleLogic(data){
print("hello");
_counter = _counter + 1;
_inAdd.add(_counter);
}
}
How to achieve my functionality using this bloc class?
dart flutter
add a comment |
up vote
0
down vote
favorite
I have two Activity.
Activity 1 ------> Text
Activity 2 ------> Increment Button
When user click on Activity 2 button then in Activity 1 Text Field will increment like counter.
My Current Bloc class:
class IncrementBloc implements BlocBase {
int _counter;
StreamController<int> _counterController = StreamController<int>();
Sink<int> get _inAdd => _counterController.sink;
Stream<int> get outCounter => _counterController.stream;
StreamController _actionController = StreamController();
Sink get incrementCounter => _actionController.sink;
IncrementBloc(){
_counter = 0;
_actionController.stream.listen(_handleLogic);
}
@override
void dispose() {
_actionController.close();
_counterController.close();
}
void _handleLogic(data){
print("hello");
_counter = _counter + 1;
_inAdd.add(_counter);
}
}
How to achieve my functionality using this bloc class?
dart flutter
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have two Activity.
Activity 1 ------> Text
Activity 2 ------> Increment Button
When user click on Activity 2 button then in Activity 1 Text Field will increment like counter.
My Current Bloc class:
class IncrementBloc implements BlocBase {
int _counter;
StreamController<int> _counterController = StreamController<int>();
Sink<int> get _inAdd => _counterController.sink;
Stream<int> get outCounter => _counterController.stream;
StreamController _actionController = StreamController();
Sink get incrementCounter => _actionController.sink;
IncrementBloc(){
_counter = 0;
_actionController.stream.listen(_handleLogic);
}
@override
void dispose() {
_actionController.close();
_counterController.close();
}
void _handleLogic(data){
print("hello");
_counter = _counter + 1;
_inAdd.add(_counter);
}
}
How to achieve my functionality using this bloc class?
dart flutter
I have two Activity.
Activity 1 ------> Text
Activity 2 ------> Increment Button
When user click on Activity 2 button then in Activity 1 Text Field will increment like counter.
My Current Bloc class:
class IncrementBloc implements BlocBase {
int _counter;
StreamController<int> _counterController = StreamController<int>();
Sink<int> get _inAdd => _counterController.sink;
Stream<int> get outCounter => _counterController.stream;
StreamController _actionController = StreamController();
Sink get incrementCounter => _actionController.sink;
IncrementBloc(){
_counter = 0;
_actionController.stream.listen(_handleLogic);
}
@override
void dispose() {
_actionController.close();
_counterController.close();
}
void _handleLogic(data){
print("hello");
_counter = _counter + 1;
_inAdd.add(_counter);
}
}
How to achieve my functionality using this bloc class?
dart flutter
dart flutter
edited yesterday
dshukertjr
803422
803422
asked 2 days ago
Yeahia2508
1,47231435
1,47231435
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53361711%2freal-time-data-change-between-two-activity-in-flutter-bloc-pattern%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown