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

Поділитися
Вставка
  • Опубліковано 3 жов 2024
  • In this guide you will learn everything you need about Kotlin Flows in your everyday life as Android developer.
    ⭐ Get certificates for your future job
    ⭐ Save countless hours of time
    ⭐ 100% money back guarantee for 30 days
    ⭐ Become a professional Android developer now:
    pl-coding.com/...
    💻 Let me personally review your code and provide individual feedback, so it won't backfire and cost you a fortune in future:
    elopage.com/s/...
    Subscribe to my newsletter for regular Android, Kotlin & Architecture advice!
    pl-coding.com/...
    Join this channel to get access to perks:
    / @philipplackner
    Regular live codings on Twitch:
    / philipplackner
    Join my Discord server:
    / discord
    Regular programming advice on my Instagram page: / _philipplackner_
    Checkout my GitHub: github.com/phi...
    You like my free content? Here you can buy me a coffee:
    www.buymeacoff...

КОМЕНТАРІ • 139

  • @PhilippLackner
    @PhilippLackner  2 роки тому +302

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

  • @USS_Daedalus
    @USS_Daedalus 2 роки тому +75

    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 роки тому +23

    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!

  • @ahmedel-hady3249
    @ahmedel-hady3249 2 роки тому +7

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

  • @jatinvashisht4293
    @jatinvashisht4293 2 роки тому +2

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

  • @Berk45632
    @Berk45632 2 роки тому +1

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

  • @thomaswaldorf2829
    @thomaswaldorf2829 2 роки тому +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!

  • @johndoe5420
    @johndoe5420 2 роки тому +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

  • @jorgearturorodriguez9432
    @jorgearturorodriguez9432 2 роки тому +5

    As always, well explained and quality content!

  • @jaygitonga2026
    @jaygitonga2026 2 роки тому +2

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

  • @mohammad-hossein-farzanegan
    @mohammad-hossein-farzanegan 6 місяців тому

    best start for learn Flows..
    Thanks philipp

  • @LikeFactoryMade
    @LikeFactoryMade 7 місяців тому

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

  • @tanjimahmed213
    @tanjimahmed213 2 роки тому +2

    Thanks, Phillip it's really helpful

  • @gokuldas027
    @gokuldas027 2 роки тому +8

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

    • @mouzinu
      @mouzinu 2 роки тому +3

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

    • @gokuldas027
      @gokuldas027 2 роки тому

      @@mouzinu Oh great, I missed that..

  • @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

  • @AbolfazlKalemati
    @AbolfazlKalemati 6 місяців тому

    Have a great explantion about the concept of Flow.

  • @buddaset4226
    @buddaset4226 2 роки тому

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

  • @damercy
    @damercy 2 роки тому

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

  • @dewetvanrooyen8458
    @dewetvanrooyen8458 7 місяців тому

    Great , thanks
    now it make sense.

  • @jopadjr
    @jopadjr 2 роки тому

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

  • @bjugdbjk
    @bjugdbjk 2 роки тому

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

  • @DrAboElfotoh
    @DrAboElfotoh Рік тому

    you always save me, keep up. Thanks Philipp 🙏

  • @arch10
    @arch10 2 роки тому

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

  • @CitizenWarwick
    @CitizenWarwick 2 роки тому

    Thank you Philipp! nicely explained

  • @a2ashraf
    @a2ashraf 2 роки тому +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…

  • @kaizen960
    @kaizen960 2 місяці тому

    Great video!

  • @souhailab6082
    @souhailab6082 Місяць тому

    Great video !🙏

  • @venkatesh4307
    @venkatesh4307 2 роки тому +1

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

  • @siarheisudakou4455
    @siarheisudakou4455 2 роки тому

    Excellent lesson! Thanks a lot!

  • @this-is-bioman
    @this-is-bioman 10 місяців тому +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!

  • @nksaroj
    @nksaroj 2 роки тому

    Great content mate

  • @VeronikaDoma-f5y
    @VeronikaDoma-f5y 2 роки тому

    Awesome! Thank you! 🔥🔥🔥♥♥♥

  • @muhannddh
    @muhannddh 2 роки тому

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

  • @varunjohnjohn
    @varunjohnjohn Рік тому

    Thanks bro

  • @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 2 місяці тому

      +1 to that

    • @avadhutredekar
      @avadhutredekar 2 місяці тому

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

  • @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

  • @РусланСамарбаев
    @РусланСамарбаев 2 роки тому

    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)

  • @ekoprasetyo3999
    @ekoprasetyo3999 2 роки тому +4

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

    • @PhilippLackner
      @PhilippLackner  2 роки тому

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

  • @ondrejhoos142
    @ondrejhoos142 2 роки тому

    Great, thank you!

  • @irsathkareem7513
    @irsathkareem7513 2 роки тому

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

  • @xavier4107
    @xavier4107 10 місяців тому

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

  • @iftak01
    @iftak01 2 роки тому

    was learning it today again lol

  • @kursuspintar
    @kursuspintar Рік тому

    Very helpful

  • @androidpc9656
    @androidpc9656 Рік тому

    Thanks really usefull

  • @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 :)

  • @nomadicamit2523
    @nomadicamit2523 2 місяці тому

    Amazing

  • @haoqian1465
    @haoqian1465 2 роки тому

    very helpful!

  • @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.

  • @PandaTop.
    @PandaTop. 2 роки тому +1

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

  • @nghiango5137
    @nghiango5137 2 роки тому

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

  • @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

  • @GriNAME
    @GriNAME 2 роки тому

    Thank you!

  • @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!

  • @renzcarlosalanga6077
    @renzcarlosalanga6077 2 роки тому

    Dude your awesome

  • @rabaka7899
    @rabaka7899 2 роки тому

    Really helpful

  • @bjugdbjk
    @bjugdbjk 2 роки тому

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

  • @kenanhas9404
    @kenanhas9404 10 місяців тому

    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?

  • @Joe-yu9wc
    @Joe-yu9wc 2 роки тому

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

  • @mrpi230
    @mrpi230 2 роки тому

    Thank you, can we use flow with services.

  • @GeminiVS
    @GeminiVS 8 місяців тому +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 7 місяців тому +1

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

    • @GeminiVS
      @GeminiVS 7 місяців тому

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

  • @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

  • @vazhakentchiashvili2198
    @vazhakentchiashvili2198 2 роки тому

    YAAAAAAAAAAY 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 :)

  • @adbysantos6603
    @adbysantos6603 Рік тому

    Would collectLatest fit well for debouncing?

  • @androiddev7267
    @androiddev7267 2 роки тому

    can we use kotlin flows without jetpack compose?

  • @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?

  • @cinnybun739
    @cinnybun739 2 роки тому

    Dayum!

  • @imbc7867ghuui9
    @imbc7867ghuui9 2 роки тому

    You are crazy!

  • @nachiketgomkale5400
    @nachiketgomkale5400 2 роки тому

    what exactly is emit ??

  • @ManojPedvi
    @ManojPedvi 2 роки тому

    First view, like and comment :)

  • @Punarjagran
    @Punarjagran 2 роки тому

    Easy 🌺👌✨☺️🙏

  • @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

  • @konstantinchernyaev3011
    @konstantinchernyaev3011 2 роки тому

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

  • @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 Рік тому

    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 Рік тому +1

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

    • @xCrawfly
      @xCrawfly 3 місяці тому

      @@jhNic thanks!