ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

Flutter - Using a future builder with infinite list view

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ส.ค. 2024
  • - Using a future build works great to render widgets in the future.
    - Construct a future builder.
    - Show the states changes.
    - Use the future builder to render a list view.
    ~ Source Code Used ~
    gist.github.com/branflake2267...

ความคิดเห็น • 41

  • @haileprime9873
    @haileprime9873 5 ปีที่แล้ว +18

    i was looking for a way to load more contents when the list view is scrolled

  • @OscarShen1
    @OscarShen1 6 ปีที่แล้ว +1

    All of your flutter videos are super helpful to me. And especially appreciate that you also kept mentioning those keyboard shortcuts. I learn not only the framework, but also the IDE.

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว +1

      Awesome, thanks! Thanks for the feedback too!

  • @gambar
    @gambar 5 ปีที่แล้ว +1

    "****loads of useful info in here" alert!!!! Awesome tips, Brandon. Thanks!

  • @benerler
    @benerler 3 ปีที่แล้ว

    Thanks a lot!

  • @tochanenko
    @tochanenko 6 ปีที่แล้ว +5

    Nice videos! I don't understand why you have such a low amount of subs

  • @mrpakravian
    @mrpakravian 5 ปีที่แล้ว +2

    Amaizing teaching method
    Detailed instructions
    Just great

  • @demircaner
    @demircaner 4 ปีที่แล้ว +3

    Where is "with infinite list view" part?????

  • @gabekrambs4376
    @gabekrambs4376 6 ปีที่แล้ว +1

    This is great. Thanks!

  • @nussknacker2719
    @nussknacker2719 6 ปีที่แล้ว +3

    Nice Video! Please keep going and make more Google Flutter Videos! 😀
    Greetings from Germany :)

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว

      Thank you and thanks for the feedback! I'm prepping for the next videos and hope to get them out soon.Thanks!

  • @thurainhein2573
    @thurainhein2573 6 ปีที่แล้ว +1

    thank sir! wait for next flutter tutorial more and more , please

  • @SmashHighlights
    @SmashHighlights 5 ปีที่แล้ว

    Very helpful video, thanks!
    At 8:54 you point out that you could have created a StatefulWidget but instead you just make a method.
    I've noticed this too, but I don't understand the benefits of using Stateful/Stateless classes.

  • @creativelymedia6050
    @creativelymedia6050 6 ปีที่แล้ว

    Could you give an example with paging and the streambuilder using firestore?

  • @edieskysolis709
    @edieskysolis709 6 ปีที่แล้ว

    Thanks for your videos, They are very helpful. Just one question if you want to call Navigator.push in FutureBuilder, how to do it? For example, this code returns an exception
    Widget build(BuildContext context) {
    var futureBuilder = new FutureBuilder(
    future: _getData(),
    builder: (BuildContext context, AsyncSnapshot snapshot) {
    switch (snapshot.connectionState) {
    case ConnectionState.none:
    case ConnectionState.waiting:
    return new Text('loading...');
    default:
    if (snapshot.hasError)
    Navigator.pushNamed(context, "/other-page");
    else
    return createListView(context, snapshot);
    }
    },
    );

  • @cesarardila2546
    @cesarardila2546 4 ปีที่แล้ว

    Hi Brandon... Pretty cool video... How ever I dont know if you can help me to extract all pictures on the phone to show them on a gridview... I already did it but app crash because It runs out of memory cause' its loading all pics at once... Please if you know I appreciate. I already searched on google and there is no plugin there is nothing to fix this problem. Thanks so much

  • @Rrafuck
    @Rrafuck 6 ปีที่แล้ว

    Is it possible to return FutureBuilder inside ListView.builder itemBuilder? To show spinner while next chunk is loading.

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว

      I don't see why not. I'm guessing a more efficient solution would be using a statefull widget. Or I've seen an animation controller used. I haven't tried it yet. I use a statefull widget in some of my item widgets. I'd try it out and see how it feels.

    • @Rrafuck
      @Rrafuck 6 ปีที่แล้ว

      your future builder rebuild whole list, is it possible to rebuild only tail of list (without recalculating sizes of head widgets)?

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว

      I use the firebase animated list, and think this might do what you want. I'd check out it's source. If an item is updated it redraws the updates items. I'd also ask in the gitter.im room for other ideas.

  • @GianMarcoDiFrancesco
    @GianMarcoDiFrancesco 6 ปีที่แล้ว +3

    is possible use with FirebaseAnimatedList? thank you

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว +1

      Oh yeah, I do this in my app, and I'll be showing how to do this in the near future.

    • @Rrafuck
      @Rrafuck 6 ปีที่แล้ว +1

      FirebaseAnimatedList is the AnimatedList (which animate only items sizes, not ordering).

    • @GianMarcoDiFrancesco
      @GianMarcoDiFrancesco 6 ปีที่แล้ว +1

      Brandon Donnelson Can you share an example?

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว +1

      I'm hoping to create a video showing the animated list with a future this week.

    • @GianMarcoDiFrancesco
      @GianMarcoDiFrancesco 6 ปีที่แล้ว +1

      Brandon Donnelson thank you

  • @jairw4084
    @jairw4084 6 ปีที่แล้ว

    why "Only Static members can be accessed in initializer" for future field.

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว

      I'm not sure I follow yet. I'd need more context on what you mean in the initializer. A static class member is one way to get to the data.

    • @jacobosoffer
      @jacobosoffer 6 ปีที่แล้ว

      Only members marked as static in the class declaration can be accessed through the class initializer (without creating an object from the class first). If the member isn't marked as static, you need to create a class instance and then access it through there.

  • @satyak1337
    @satyak1337 6 ปีที่แล้ว

    Please create a video to handle pagination API using future builder

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว +1

      Great idea. Thanks for the feedback. I'll add it to my list.

    • @satyak1337
      @satyak1337 6 ปีที่แล้ว

      I found an example but its really hard to understand since I am a beginner :-)
      proandroiddev.com/flutter-lazy-loading-data-from-network-with-caching-b7486de57f11

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว

      This might help add more context to the issue: th-cam.com/video/x3VvE6WukeY/w-d-xo.html

  • @filippopalma495
    @filippopalma495 6 ปีที่แล้ว

    Hi Brandon,
    I'm an italian developer who is learning flutter.
    I have a problem with "snapshot.connectionState", is always waiting..
    Can you help me ?
    This is my function:
    List data;
    Future getData() async{
    var client = http.Client();
    var response = await client.get(
    Uri.encodeFull("www.pippo.com"),
    headers: {
    "Accept": "application/json",
    "Authorization": "pippo"
    }
    );
    if ( response.statusCode == 200 ){
    this.setState((){
    data = json.decode(response.body);
    });
    return data;
    }
    }
    Thanks for your attention, greetings

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว

      What I would do is set some breakpoints and see how far it's getting. Which line is it hanging on?

    • @filippopalma495
      @filippopalma495 6 ปีที่แล้ว

      I fixed it, decoding json inside futureBuilder.
      Now I have another problem with dropdown button; I pass him a dinamyc list on the init, but flutter rerturns me a "overflow error".
      So I'm trying to use futureBuilder, but don't work.
      Have you already hit this problem?

    • @BrandonDonnelson
      @BrandonDonnelson  6 ปีที่แล้ว

      I think of it like this, the future builder basically waits for the future to return and then sets the state, so it renders again with the widget in the future builder. Overflow sounds like a layout config, which takes some messing around with.

    • @filippopalma495
      @filippopalma495 6 ปีที่แล้ว +1

      I fixed the error modifying the dropdownbutton.dart :)