[Python] How to fetch stream of reddit comments using flutter package draw library?

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I'm trying to fetch a stream of Reddit comments from the subreddit in flutter app. Using Python is very simple using praw library API but when I try using dart wrapper draw I couldn't able to fetch data here is my code which I'm trying to implement

    when I print comments I get I/flutter (30495): Instance of '_ControllerStream<Comment>'

    using this Instance how can I fetch individual streams full of data?

    I tried using for each method and fetch value

    I ended up getting Error

    E/flutter (30495): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: DRAWNotFoundException(Reason: "null", Message: "Bad Request")
    E/flutter (30495): #0 parseAndThrowError
    package:draw/src/exception_objector.dart:15
    E/flutter (30495): #1 Authenticator._request
    package:draw/src/auth.dart:230
    E/flutter (30495): <asynchronous suspension>
    E/flutter (30495): #2 Reddit.get
    package:draw/src/reddit.dart:633
    E/flutter (30495): <asynchronous suspension>
    E/flutter (30495): #3 ListingGenerator.generator._nextBatch
    package:draw/…/listing/listing_generator.dart:70


    in python I can just print comments by looping through this instance

    for comment in reddit.subreddit('cricket').stream.comments(skip_existing=True):
    print(comment.body)


    how can I achieve similar result in dart?

    there's isn't much information in flutter draw package documentation here is the definition of this class draw docc but its not easily understandable to my requirement , can someone point me out in right direction to achieve this??

    Continue reading...

Compartilhe esta Página