0

When I call the subscription command "_realtime.subscribe" in file "lib/apis/tweet_api.dart", line 68, so that the screen "lib/features/tweet/widgets/tweet_list.dart" is in realtime, it works fine, then when I call the same subscription command in file "lib/apis/user_api.dart", line 93, so that the screen "lib/features/user_profile/views/userprofile_veiw.dart" is in realtime, it does not work and crashes throughout the application

https://github.com/khhaki/My-social-media-app

i am trying to resolve a bug

class TweetAPI implements ITweetAPI {
  ...
  late final Stream<RealtimeMessage> _stream;
  ...
  @override
  Stream<RealtimeMessage> subscribeForLatestTweet() {
    _stream =  _realtime.subscribe(
      [
        'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.tweetscollection}.documents',
      ],
    ).stream;
   return _stream;
  }

  @override
  Stream<RealtimeMessage> getLatestTweet() {
    return _stream;
  }
...

0 Answers0