Flow Basics - The Ultimate Guide to Kotlin Flows (Part 1)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

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

  • @PhilippLackner
    @PhilippLackner  3 ปีที่แล้ว +305

    Would you also like me to make a video about unit testing flows?

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

      @Philipp Lackner your videos are out of the world! Its really Helpful.. Thanks! Yes would Love to see the unit testing flows

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

      Yes please Philipp! ❤️🙏🏻

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

      Yes yes

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

      Yes that would really be helpful

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

      Yes please

  • @USS_Daedalus
    @USS_Daedalus 3 ปีที่แล้ว +76

    From i know is Philipp only one of the best Native Android Devs who make Up to Date Tutorials and that with Kotlin.
    So underrated.

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

    I would like to say thank you for not only giving these great courses for free but also for your courses helping me to overcome the Imposter syndrome. When I watch your videos, I feel I can learn the topic. I appreciate that you are so positive and professional. Thank you so much!

  • @JamesShisiah
    @JamesShisiah 27 วันที่ผ่านมา

    Your example helped me understand collect{} and collectLatest{}. You are a really good teacher.

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

    I don't see any other android youtuber providing this level of content

  • @ahmedel-hady3249
    @ahmedel-hady3249 3 ปีที่แล้ว +7

    I already know this playlist will be fire 🔥🔥🔥🔥

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

      Hell yes!

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

    You are not the Teacher we want. You are the Teacher we need! 💖💖💖

  • @johndoe5420
    @johndoe5420 3 ปีที่แล้ว +7

    Great introductory video, can't wait for the next! I like how you keep these videos chill but informative. You have been helping me a lot with my undergraduate thesis. Love from Greece

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

    I guessed that this was how it worked, but it was real good to see it explained as plainly as you did. Thank you!

  • @jorgearturorodriguez9432
    @jorgearturorodriguez9432 3 ปีที่แล้ว +5

    As always, well explained and quality content!

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

    Philipp! You're amazing !
    I'm jumping from video to video because what you are explaining is very interesting for me at this time - all the topics!
    Thank you very much!
    And thanks for your clear English - I'm Russian but there is no difficulties to understand you

  • @LikeFactoryMade
    @LikeFactoryMade 9 หลายเดือนก่อน

    Thank you for making these videos, they really help me better understand things.

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

    Another great video Phillip keep up the good work , can't wait for part 2

  • @mohammad-hossein-farzanegan
    @mohammad-hossein-farzanegan 8 หลายเดือนก่อน

    best start for learn Flows..
    Thanks philipp

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

    1.3K+...Thanks Philipp... I went back to your TH-cam account because I know your explanation is very easy to understand than the one I was having in Udemy

  • @AbolfazlKalemati
    @AbolfazlKalemati 7 หลายเดือนก่อน

    Have a great explantion about the concept of Flow.

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

    you always save me, keep up. Thanks Philipp 🙏

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

    I don't know a very good English, but I understood that you explain in this video. Thanks!

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

    It's a most desirable concept. I think flows will play crucial role in KMM.

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

    Thanks, Phillip it's really helpful

  • @this-is-bioman
    @this-is-bioman ปีที่แล้ว +1

    How can you be notified about anything with flows when the documentation states that flows are cold:
    > Flows are cold streams similar to sequences - the code inside a flow builder does not run until the flow is collected.
    at 11:45: you say that the block is triggered when `emit` is called, but it the other way around!

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

    Let's goooo! Thank you so much for this playlist!

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

    Hope there will be unit tests for flows as well…it’s different…you can’t collect due to dispatcher mess…you need to test as a list…

  • @gokuldas027
    @gokuldas027 3 ปีที่แล้ว +8

    Much needed lesson, Thank you..
    Can you include a video comparing LiveData and Flow, in a developer perspective about implementations.
    Edited

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

      He's already done that. You can find it searching "StateFlow vs. Flow vs. SharedFlow vs. LiveData" on his channel

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

      @@mouzinu Oh great, I missed that..

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

    Great video. Waiting for the next video in the playlist. 😄😄

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

    As long we have the flow started values by 10 inside the view model, why did we give .collectAstate(10) an initial value of 10 here?

    • @avadhutredekar
      @avadhutredekar 4 หลายเดือนก่อน

      +1 to that

    • @avadhutredekar
      @avadhutredekar 4 หลายเดือนก่อน

      I think we are setting initial value as 10 for the UI to show even before the actual flow starts to emit the values.

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

    Thank you Philipp! nicely explained

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

    Hello. Record Please Lessons on Services,
    Broadcast Receivers,
    Content Providers.

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

    Great way of explanation on collect and colectLatest ...thanks man !!

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

    What do you think about RxJava, RxKotlin, or RxAndroid philipp?

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

      Haven't used RxKotlin or RxAndroid. RxJava is a great library, but I prefer flows because of coroutines

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

    Hi, Philipp Lackner
    Which dependency injection should we learn? Hilt, dagger 2, koin,...

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

    which keyboard are you using? The sound of your keyboard is coming out so professional and I liked it :) share a link please :)

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

    Flow has changed quite a bit since i last used it a couple years ago. I don't remember SharedFlow and StateFlow being there (or maybe i wasn't aware at the time) but i read the docs a lot while using it so i don't think i missed it

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

    First of all, thank you so much for these amazing tutorials, Could you please also in the future include some Gradle tutorials

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

    thanks for your great videos. I used this. I wanted to reset it after it was 0 . I put it in Job(Coroutine) . in special condition I canceled the job. then try to call collect function again . but something weird happened. countdown timer digit was reset and was subtracted like 2 at a time instead of 1. it is like collect function is called two times and it is faster than usual to near 0.

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

    Great content mate

  • @VeronikaDoma-f5y
    @VeronikaDoma-f5y 2 ปีที่แล้ว

    Awesome! Thank you! 🔥🔥🔥♥♥♥

  • @dewetvanrooyen8458
    @dewetvanrooyen8458 8 หลายเดือนก่อน

    Great , thanks
    now it make sense.

  • @souhailab6082
    @souhailab6082 3 หลายเดือนก่อน

    Great video !🙏

  • @kaizen960
    @kaizen960 4 หลายเดือนก่อน

    Great video!

  • @РусланСамарбаев
    @РусланСамарбаев 3 ปีที่แล้ว

    Philipp, your content is the greatest! Why do you do an overview of new technology only? Many projects were created on Rx. Please make a comparison of this tool)

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

    Excellent lesson! Thanks a lot!

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

    Hello Philip. I was working with xml. When I tried the code in this lesson, when I turned the screen sideways, it started counting down from 10 again. I wonder if flow is not lifecycle aware like livedata?

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

    Is it possible to have like parametrized flow collections? Or flows are bound to only one..like..value? Say I have some parametrized fragment and I want to receive data, based on this parameter. Sooo...technically, I can use a ViewModel, but sheesh I will need to refresh my VM understanding. Will that VM be fragment scoped or singleton? I will look up in your videos an explanation of ViewModel. Because you make subjects so much easier!

  • @SPENDUSDT
    @SPENDUSDT 10 หลายเดือนก่อน +1

    I'm not sure if this still working fine in 2024. I try to do everything following what you're teaching but my code just get many red color on it. starting at
    setContent {
    KotlinFlowsTheme {
    and many red words after that. All of it seem to be "Unsolved reference" problem
    class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContent {
    KotlinFlowsTheme {
    val viewModel = viewModels()
    val time = viewModel.countDownFlow.collectAsState(initial = 10)
    Box(modifier = Modifier.fillMaxSize()) {
    Text(
    text = time.toString(),
    fontSize = 30.sp,
    modifier = modifier.align(Alignment.Center)
    )
    }
    }
    }
    }
    }

    • @nguyenthanhcong8613
      @nguyenthanhcong8613 9 หลายเดือนก่อน +1

      Here: text= time.toString()
      Replace: text = time.value.toString()

    • @SPENDUSDT
      @SPENDUSDT 9 หลายเดือนก่อน

      ​@@nguyenthanhcong8613 thanks, it's my bad I just create empty activity while I should create compose empty activity 🤣😂

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

    Phillip, most awaited playlist, good luck, but we need more from you, will u made exoplayer customization playlist???? Please

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

    Can you explain about delay function, collectLatest operator just work as we expected when the time of delay function inside collectFlow() function is bigger than the delay function in countDownValue

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

    Can I convert the type of Flow that is returned by Room DB. Let's say I have a Flow that is returned by Room now I want to create a new Flow with type of Flow in my repository class. Is this possible?

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

    Nice content. And also can you make more tutorials on Android with xml.

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

    Thank you, can we use flow with services.

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

    Very helpful

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

    Would collectLatest fit well for debouncing?

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

    I learned the coroutines from your channel, I knew about flows but still it was a good refreshment. Would you make a playlist about ktor and making backend server for apps to?

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

      I got 2 very detailed courses on my website about that:
      pl-coding.com/premium-courses

  • @Joe-yu9wc
    @Joe-yu9wc 3 ปีที่แล้ว

    Hi can you please make some contents about livedata->flow? Thank you very much.

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

    can we use kotlin flows without jetpack compose?

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

    Great, thank you!

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

    Dude your awesome

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

    Thanks bro

  • @nomadicamit2523
    @nomadicamit2523 4 หลายเดือนก่อน

    Amazing

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

    was learning it today again lol

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

    Great playlist man !! Do cover flatMap nd flatMapMerge nd flatMapConcat operators , Theese are pretty confusing !!

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

    what exactly is emit ??

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

    very helpful!

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

    Really helpful

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

    YAAAAAAAAAAY THANK YOU!

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

    Thanks really usefull

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

    Thank you!

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

    Just noticed you are from Germany ,which uses British english,
    but you said zeee (while pronouncing z) - which is American English,
    lol :)

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

    Dayum!

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

    why you collected flow in a coroutine , i did not get the reason

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

      Collecting a flow is suspending and therefore has to be done in a coroutine

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

      @@PhilippLackner thank you so much for replay man

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

      @@rexitspersonal8353 I recommend to watch my coroutines Playlist first then before jumping into flows

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

      @@PhilippLackner one more thing. we also collected flow in main activity as a state . which is not in coroutine

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

      @@PhilippLackner yes

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

    You are crazy!

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

    First view, like and comment :)

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

    3:18 Coroutine with Channel can do this 😶‍🌫️

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

    Easy 🌺👌✨☺️🙏

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

    what is that? -> KotlinFlowsTheme

  • @SAJJADAHMAD-uy3hu
    @SAJJADAHMAD-uy3hu ปีที่แล้ว

    Pls make some real use of flow in your project that actually utilize flow rather than mimicking😮 it like video streaming app using flow.

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

    what i have to do if i am not using compose and i want to show this changes value in textView in Activity?
    @Philipp Lackner

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

    Using implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0" like he did
    8:53 val viewModel = viewModel() doesn't work
    import androidx.appcompat.app.AppCompatActivity
    import android.os.Bundle
    import androidx.lifecycle.viewmodel.compose.viewModel
    class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    val viewModel = viewModel() //error
    }
    }
    Please someone help

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

      solution:
      use implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0"

    • @xCrawfly
      @xCrawfly 5 หลายเดือนก่อน

      @@jhNic thanks!