Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank screen when run main.dart in example #78

Closed
veyhong opened this issue Sep 3, 2020 · 11 comments
Closed

Blank screen when run main.dart in example #78

veyhong opened this issue Sep 3, 2020 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@veyhong
Copy link

veyhong commented Sep 3, 2020

when I run: flutter run -t lib/single_conversation.dart -d all everything work fine.
but when I try to run main.dart by : flutter run -t lib/main.dart -d all it show blank screen!

Screenshot 2020-09-03 at 5 01 57 PM

It seem like in the main.dart do not create any channel. I cannot have it test.

gz#5734

@imtoori
Copy link
Contributor

imtoori commented Sep 3, 2020

it seems like you have no channels that match your filter

@veyhong
Copy link
Author

veyhong commented Sep 3, 2020

seem like in the main.dart, there is not code that create any channel.

@imtoori
Copy link
Contributor

imtoori commented Sep 3, 2020

that's true, but intentional

have you followed the tutorial? https://getstream.io/chat/flutter/tutorial

this is the documentation on how to create channels https://getstream.io/chat/docs/initialize_channel/?language=dart

@veyhong
Copy link
Author

veyhong commented Sep 3, 2020

I have follow the tutorial, and the sourcecode in example is the end result. So if I wanted to build something like a groupchat, many users will watch on the same channel, is that correct ? to implement it, if a user created a channel, other user just need to watch on that channel, and pass messages to that channel, and there is no need to create channel any more on other user device ?

It would be more easy to test out, if there is a example to create different type of chat like single chat or GroupChat.

@imtoori
Copy link
Contributor

imtoori commented Sep 4, 2020

I can suggest to take a look at our documentation
For a groupChat you need to create a channel with the users as members and then everyone will see the channel in the channellist, but you need to use proper filters

@veyhong
Copy link
Author

veyhong commented Sep 4, 2020

What I did for now is , I run app using single_conversation.dart with a user. then I run main.dart with another different user. but still main.dart not showing any channel list. but it receive message from single_conversation.dart

@veyhong
Copy link
Author

veyhong commented Sep 4, 2020

I found out this code in tutorial to create a channel, is there any equivalent method in flutter SDK to setup a channel ?

Future<CancelListening> listenToChannel(String channelId, Listener listener) async {
  await platform.invokeMethod<String>('setupChannel', {'channelId': channelId});
  var subscription = EventChannel('io.getstream/events/$channelId').receiveBroadcastStream(nextListenerId++).listen(
    (results) {
      listener(json.decode(results));
    },
    cancelOnError: true,
  );

  return () {
    subscription.cancel();
  };
}

@imtoori
Copy link
Contributor

imtoori commented Sep 4, 2020

yes, as I said in the documentation you can find everything

https://getstream.io/chat/docs/initialize_channel/?language=dart

this is the section for creating channels

@tbarbugli tbarbugli added the bug Something isn't working label Sep 7, 2020
@tbarbugli
Copy link
Member

@imtoori for the demo application what about we show some message when the channel list does not match anything?

ie.

We could not find any channel for this query.

Please make sure to use this example project along with the Flutter tutorial: https://getstream.io/chat/flutter/tutorial

If your application already has users and channels, you might need to adjust your query channel as explained in the docs [...]

Adding the + button to create a channel will also help (though you need to show a similar message when there are no users to chat with)

@tbarbugli tbarbugli added enhancement New feature or request and removed bug Something isn't working labels Sep 7, 2020
@imtoori
Copy link
Contributor

imtoori commented Sep 7, 2020

@tbarbugli it's a good idea and it will solve this kind of problems

@imtoori
Copy link
Contributor

imtoori commented Oct 1, 2020

@veyhong in the example app you can find a simple example of channel creation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants