Flutter: Stream is allowed?
up vote
2
down vote
favorite
Sometimes, when I´m watching some projects that work with streams, I see something like:
final controller = StreamController<Null>();
and then:
controller.sink.add(null);
So, is allowed to pass null in streams? Why?
null stream flutter sink
add a comment |
up vote
2
down vote
favorite
Sometimes, when I´m watching some projects that work with streams, I see something like:
final controller = StreamController<Null>();
and then:
controller.sink.add(null);
So, is allowed to pass null in streams? Why?
null stream flutter sink
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Sometimes, when I´m watching some projects that work with streams, I see something like:
final controller = StreamController<Null>();
and then:
controller.sink.add(null);
So, is allowed to pass null in streams? Why?
null stream flutter sink
Sometimes, when I´m watching some projects that work with streams, I see something like:
final controller = StreamController<Null>();
and then:
controller.sink.add(null);
So, is allowed to pass null in streams? Why?
null stream flutter sink
null stream flutter sink
asked Nov 18 at 12:04
Little Monkey
10810
10810
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Null
as generic type argument was used before void
was supported and means in this case that only the occurence of the even is meaningful, but the event value is not.
With Null
the value null
is the only valid event value. With void
a callback function can be passed that does not take any parameter.
add a comment |
up vote
1
down vote
That's a hack around the fact that sinks require an argument.
Some peoples use streams as a flux of events instead of a value changing over time, but the class isn't designed with this in mind. They typically try to represent the following method as a stream:
void onClick();
So, basically it´s allowed, even if streams are not designed to be used like this.
– Little Monkey
Nov 18 at 12:40
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Null
as generic type argument was used before void
was supported and means in this case that only the occurence of the even is meaningful, but the event value is not.
With Null
the value null
is the only valid event value. With void
a callback function can be passed that does not take any parameter.
add a comment |
up vote
1
down vote
accepted
Null
as generic type argument was used before void
was supported and means in this case that only the occurence of the even is meaningful, but the event value is not.
With Null
the value null
is the only valid event value. With void
a callback function can be passed that does not take any parameter.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Null
as generic type argument was used before void
was supported and means in this case that only the occurence of the even is meaningful, but the event value is not.
With Null
the value null
is the only valid event value. With void
a callback function can be passed that does not take any parameter.
Null
as generic type argument was used before void
was supported and means in this case that only the occurence of the even is meaningful, but the event value is not.
With Null
the value null
is the only valid event value. With void
a callback function can be passed that does not take any parameter.
answered Nov 18 at 16:33
Günter Zöchbauer
306k63906853
306k63906853
add a comment |
add a comment |
up vote
1
down vote
That's a hack around the fact that sinks require an argument.
Some peoples use streams as a flux of events instead of a value changing over time, but the class isn't designed with this in mind. They typically try to represent the following method as a stream:
void onClick();
So, basically it´s allowed, even if streams are not designed to be used like this.
– Little Monkey
Nov 18 at 12:40
add a comment |
up vote
1
down vote
That's a hack around the fact that sinks require an argument.
Some peoples use streams as a flux of events instead of a value changing over time, but the class isn't designed with this in mind. They typically try to represent the following method as a stream:
void onClick();
So, basically it´s allowed, even if streams are not designed to be used like this.
– Little Monkey
Nov 18 at 12:40
add a comment |
up vote
1
down vote
up vote
1
down vote
That's a hack around the fact that sinks require an argument.
Some peoples use streams as a flux of events instead of a value changing over time, but the class isn't designed with this in mind. They typically try to represent the following method as a stream:
void onClick();
That's a hack around the fact that sinks require an argument.
Some peoples use streams as a flux of events instead of a value changing over time, but the class isn't designed with this in mind. They typically try to represent the following method as a stream:
void onClick();
answered Nov 18 at 12:26
Rémi Rousselet
21.1k23269
21.1k23269
So, basically it´s allowed, even if streams are not designed to be used like this.
– Little Monkey
Nov 18 at 12:40
add a comment |
So, basically it´s allowed, even if streams are not designed to be used like this.
– Little Monkey
Nov 18 at 12:40
So, basically it´s allowed, even if streams are not designed to be used like this.
– Little Monkey
Nov 18 at 12:40
So, basically it´s allowed, even if streams are not designed to be used like this.
– Little Monkey
Nov 18 at 12:40
add a comment |
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%2f53360670%2fflutter-streamnull-is-allowed%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