How to return data after stream was subscribed?

flutter stream subscription
flutter stream foreach
bad state: stream has already been listened to.
flutter dart stream example
flutter future vs stream
dart yield
flutter stream connection state
dart future

How to return data after the stream was subscribed? For example, I get URL in subscription, and then I want to return the stream with data based on this URD

public get() {
    this.service.getData().subscribe((data: any) => {
        // data was setted here
        this.url = data;
    });

    return this.http.get(this.url)
        .map(r => {
            ...
            return obj;
        });
}

You should use concatMap (or mergeMap) for this and turn this into a chain:

public get() {
  this.service.getData().do((data: any) => {
      // data was set here
      this.url = data;
    })
   .concatMap(data => this.http.get(data))
   .map(r => {
     ...
     return obj;
    });
}

Or maybe you don't even need to be using this.url (I don't know what's your use-case).

public get() {
  this.service.getData()
   .concatMap(url => this.http.get(url))
   .map(r => {
     ...
     return obj;
    });
}

Asynchronous programming: streams, Data sequences include user-generated events and data read from files. There are two kinds of streams: single subscription or broadcast. Where a normal function returns the result, an asynchronous function returns a Future, which will  Returning an Input Steam enables your calculation to be performed on an ongoing basis as data is read from it, potentially even in a separate thread. It is equivalent to a unix command line pipe. If the processing takes a significant time to complete, this will effectively hide that processing time from the user by distributing it (or shunting it off to another core) and returning results a little at a time.

this.service.getData().subscribe((data: any) => {
  // data was setted here
  return this.http.get(data)
  .map(r => {

    return r;
  });
});

or

     public get() {
        this.service.getData().subscribe((data: any) => {
        // data was setted here
        this.url = data;
        this.get2(this.url);
        });
}
public get2(url){
     return this.http.get(url)
      .map(r => {
        ...
        return obj;
      });
}

Flutter Stream Basics for Beginners - Flutter Community, The next thing to do is to be able to get the values from a stream. will only get the values that are emitted (put onto the stream) after the subscription. is cancelling the listening when you're no longer required to receive the data. Below is a Future that will return a random value after waiting 1 second. WCF returns to you a Stream wrapper which read data from server’s response. And if you enabled Streaming for your service than reading on the client side happens without buffering. WCF just doesn’t know what server’s stream size is. If we really need to know on the client stream’s size here what we can do.

try:

public get() {
        this.service.getData().subscribe((data: any) => {
        // data was setted here
        this.url = data;

        //get data with the URL
        return this.http.get(data)
            .map(r => {
                //Get something with data obtained with the URL
                return obj;
              });
        });
      }

The Extensive Guide to Creating Streams in RxJS, Some functions return streams and to make use of them the focus naturally is on Extract data to an array first; Use the generate function from the next section to During subscription RxJS finds out that document is an EventTarget type,  First we create a stream which gets its data from the getData() function, which simply returns a sample string after a delay of 5 sec. Next, we listen to the stream for the data incoming with .listen() method. This has the incoming ‘data’, an onDone method which marks the completion,

Use Streams for Data, Populating a stream: Data gets into a stream from a StreamController . We'll look at the to some data. The typical way is to use the stream's listen() method to subscribe to the stream. Each of these properties returns a future. For example: Unsubscribe from Linus Tech Tips? Sign in to add this video to a playlist. Sign in to report inappropriate content. Sign in to make your opinion count. Sign in to make your opinion count. The

Using observables to pass values, The subscribe() call returns a Subscription object that has an unsubscribe() method, which Delayed values can continue to be delivered to the next handler after As a general term, we refer to data published by an observable as a stream. Whenever data is written to the IAsyncEnumerable or ChannelWriter object, the hub method on the server receives a new item with the data from the client. If using an IAsyncEnumerable object, the stream ends after the method returning stream items exits.

Current Trends in Database Technology, Subscriptions are registered using WXQuery, Our XQueryscription language that will be All queries reference data stream photons as their single lery 1 (Q1) is shown $p/coord/cel/dec <= −40.0 return &vela: { $p/coord/cel/ra ) { $p/coord/cel​/dec } We assume that to 4 have been registered one after another in ascending  other solution is when you need data inside getValueFromObservable to return the observable using of operator and subscribe to the function. function getValueFromObservable() { return this.store.subscribe((data: any) => { // do something with data here console.log(data); //return again observable.