List Method .fold() in Dart and Flutter

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ก.ค. 2024
  • In this series, we will learn more about different list methods in #Dart and see how we can use them in #Flutter. In this episode we have a closer look at .fold() method in different list types and see how we can use this method to calculate the total amount of prices in a table in a flutter application.
    00:00 - Introduction
    00:22 - Example one: forEach and fold method explanation on a list of String
    03:40 - Example two: fold method on list of integer
    04:14 - Example three: fold method on list of object
    05:18 - Overview over the boilerplate code
    07:14 - fold method in Text Widget
    08:26 - Outro
    ⭐️⭐️Helpful Ressources ⭐️⭐️
    DartPad: dartpad.dev/a64685664fccd0c94...
    GitHub Repository: github.com/mt-tadayon/fold_tu...
    Tools we use to grow our TH-cam channel
    TubeBuddy Review - Manage Your TH-cam Channel Easily
    www.tubebuddy.com/flutterexpl...
    Our current TH-cam gear
    🎙 Samson Mic: amzn.to/324Gpof
    📟 Satechi USB-C Adapter: amzn.to/3kUdQ5M
    💻 MacBook Pro: amzn.to/3iQ9MBx
    📹 Lumix FZ1000: amzn.to/3g7tW8D
    ⭐️⭐️Follow us ⭐️⭐️
    Twitter Mahtab - / mahtab_dev
    GitHub Mahtab - github.com/mt-tadayon
    Twitter Max - / flutter_exp
    Github Max - github.com/md-weber
    Homepage - myracledesign.de/blog
    ⭐️⭐️ Support ⭐️⭐️
    If you read this so far, thank you once more. If you like to support us, here are some links that could help us a lot.
    Donation via Streamlabs - You are free to donate us a small amount, so we can keep up our work.
    flutterexplained.live/
    Amazon Affiliate Link - You buy for the same price and I get a small amount of it. This leads to an amazing Flutter book that I can recommend to every beginner of flutter amzn.to/2uOJXON

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

  • @RetroPortalStudio
    @RetroPortalStudio 4 ปีที่แล้ว +11

    Great Content ! ✌😁 Keep up the good work

  • @adrek9018
    @adrek9018 2 ปีที่แล้ว +1

    Excelent explanation. Thanks

  • @ahmednafiunoman5040
    @ahmednafiunoman5040 2 ปีที่แล้ว +1

    What a great topic ...much love sending to you.

  • @longtimedeveloper6498
    @longtimedeveloper6498 3 ปีที่แล้ว +1

    Very nice description of the .fold() method, thank you!

  • @gautambedi591
    @gautambedi591 ปีที่แล้ว

    Very nice explanation

  • @user-cx4eu8xc5v
    @user-cx4eu8xc5v 4 ปีที่แล้ว +1

    awesome !!! Thank you so much (from S.Korea)

  • @astridtaw
    @astridtaw 3 ปีที่แล้ว +1

    Thank you so much, you made my day!

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

    Awesome tutorial !! I learnt many things.

  • @esentakos
    @esentakos 4 ปีที่แล้ว +1

    Interesting, I didn't knew about this method ! Thanks for the video.

    • @FlutterExplained
      @FlutterExplained  4 ปีที่แล้ว +1

      Great I am very happy that it helps you along your way :)

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

    great it helped a lot

  • @anirudhachakrabarty2050
    @anirudhachakrabarty2050 4 ปีที่แล้ว +1

    Awesome tutorial... I liked it ..

  • @jamshaidmalik463
    @jamshaidmalik463 ปีที่แล้ว

    very nice and simple video keep it 👆 👆

  • @moazelsawaf2000
    @moazelsawaf2000 4 ปีที่แล้ว +1

    Thanks ❤

  • @sadzolot2
    @sadzolot2 4 ปีที่แล้ว +1

    You are very good teacher :)

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

    good video thanks a lot from spain!!!

  • @maung1982
    @maung1982 ปีที่แล้ว

    Thanks

  • @arsalankhanahmed
    @arsalankhanahmed 4 ปีที่แล้ว +1

    Thank you

  • @pvarela
    @pvarela 3 ปีที่แล้ว +1

    I like how you pronounce Flutter, thank you for your video.

  • @rezahosseinkh6528
    @rezahosseinkh6528 2 ปีที่แล้ว +1

    nice channel ⭐keep going plz

  • @DigitalDesignET
    @DigitalDesignET 3 ปีที่แล้ว +1

    Good one !!!

  • @AbdullahAbdullah-vz4nk
    @AbdullahAbdullah-vz4nk 2 ปีที่แล้ว +1

    grt & tnx.

  • @ikishan96
    @ikishan96 3 ปีที่แล้ว +1

    well explained 👍

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

    ♥️♥️

  • @actionscript3661
    @actionscript3661 2 ปีที่แล้ว +1

    please need Map Properties in Dart and Flutter

  • @igor10ms
    @igor10ms 2 ปีที่แล้ว +1

    how can I replace an item in a list with another item in the same index? (ie delete an item and place another item in the same place as it was)

    • @FlutterExplained
      @FlutterExplained  2 ปีที่แล้ว

      If you know the index it is quite easy, you can just overwrite it.
      stackoverflow.com/a/63757729/3690032
      To find the index you can use methods like indexOf. I hope that helps :)

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

    if you get an error in 2021 about num not being int - simply disable null safety. This is a problem with dart not the code.

    • @FlutterExplained
      @FlutterExplained  2 ปีที่แล้ว

      Great stuff, thanks Eli :) yes, this was done in a non-null safe environment!

  • @ahmedebrahimn97
    @ahmedebrahimn97 ปีที่แล้ว

    I get error while running this...I think it's a null safety issue...how to resolve please
    //Find sum age of all friends and print it.
    List myFriends = [
    Friend(name: 'Mahtab', age: 18),
    Friend(name: 'Sara', age: 25),
    Friend(name: 'Mathias', age: 32),
    Friend(name: 'Alex', age: 22)
    ];
    int sumAge = myFriends.fold(0, (prev, friend) => prev + friend.age);
    print(sumAge);
    }