Access 7000+ courses for 60 days FREE: https://pluralsight.pxf.io/c/1291657/424552/7490
In this 2 hour tutorial, you will learn everything you need to know about Coroutines in Kotlin using demos in IntelliJ IDEA and precise presentation.
There are 5 chapters in this course.
In chapter 1, get a solid understanding of what is #coroutine in #kotlin.
- Explore the 'suspend' keyword, comparison with threads, delay function, Thread.sleep function and a lot more.
- Basics of coroutine builders: launch, async, and runBlocking.
In chapter 2, dive deeper into Coroutine Builders and explore them in detail.
- Use GlobalScope companion object to launch coroutines.
- Why GlobalScope is discouraged to use?
- Test suspending functions by writing a JUnit test case.
In chapter 3, learn to cancel coroutines and handle exceptions.
- What is cooperative coroutine? How to write a cooperative code?
- Explore job.cancel(), and job.cancelAndJoin() functions.
- Use of yield() and delay() suspending functions (suspend modifier).
- Explore what is CoroutineScope.isActive boolean flag.
- Handle CancellationException and TimeoutCancellationException.
- Use withContext(NonCancellable), withTimeout, and withTimeoutOrNull coroutine builders
In chapter 4, compose suspending functions in different ways within a coroutine.
- Explore how code execution in coroutine is sequential by default.
- How to execute suspending functions in a coroutine concurrently?
- Lazily execute async coroutine by using CoroutineStart.LAZY
In chapter 5, learn a few advanced coroutine concepts.
- Understand what is CoroutineScope?
- What is CoroutineContext?
- What is a Dispatcher?
- Role of a dispatcher: to assign a thread to a coroutine.
- Types of Dispatcher: Confined, Unconfined, Default, Main, and IO
- Components of CoroutineContext: Job, Dispatcher, and Coroutine Name.
Source code link: https://bit.ly/2QtcUWR
Timestamps:
00:00:00 Course Overview
00:03:20 Chapter 1: Coroutine Fundamentals
00:03:40 Threads vs. Coroutines
00:07:25 What are Coroutines?
00:08:34 Coroutines Properties
00:09:52 Implement Coroutines
00:22:15 delay function
00:27:38 suspend function
00:28:35 runBlocking lambda
00:33:31 Custom suspending function
00:34:41 Chapter 1: Summary
00:36:12 Chapter 2: Coroutine Builders
00:36:53 Coroutine Builders
00:38:21 Purpose of GlobalScope
00:43:26 launch coroutine builder
00:50:26 async coroutine builder
00:55:18 runBlocking coroutine builder
01:00:25 Chapter 2: Summary
01:01:53 Chapter 3: Coroutine Cancellation and Exception Handling
01:02:31 What is Cooperative Cancellation?
01:11:32 yield function
01:13:16 isActive flag
01:17:48 Handling CancellationException
01:20:29 withContext Coroutine Builder
01:22:20 Throw Exception with message
01:23:43 Timeouts: withTimeout & withTimeoutOrNull
01:28:42 Chapter 3: Summary
01:30:07 Chapter 4: Composing Suspending Functions
01:31:58 Sequential Execution
01:36:44 Concurrent Execution
01:40:40 Lazy Async Execution
01:44:53 Chapter 4: Summary
01:45:31 Chapter 5: CoroutineScope, CoroutineContext, and Dispatchers
01:46:18 CoroutineScope
01:50:15 CoroutineContext (Dispatchers)
02:07:06 Thank You!
.
.
Please donate and support my work
(If you think my free tutorials are better than paid ones :)
- Patreon: https://bit.ly/patreon-donate
- Paypal/Payoneer:
[email protected]
- UPI (only for India): smartherd@okaxis
:: If you want to develop a website or a mobile app, email me your requirement at
[email protected] :: Free demos provided beforehand ::
- Access my premium courses: https://bit.ly/sriyank-courses
Free Programming courses:
- Ruby Programming: https://bit.ly/smyt-r
- Dart Programming: https://bit.ly/smyt-d
- Kotlin Programming: https://bit.ly/smyt-k
- Java Programming: https://bit.ly/smyt-j
- Kotlin Coroutines: https://bit.ly/smyt-coru
Free Flutter course:
- Flutter App Development: https://bit.ly/2Rg7EFR
Free Android courses:
- Android using Kotlin: https://bit.ly/smyt-ka
- Android using Java: https://bit.ly/smyt-ja
- Android Material Design: https://bit.ly/2SMJqU6
- Android Jetpack Architecture: https://bit.ly/yt-j
- Android Multiple Screen Support: https://bit.ly/smyt-mss
- Android Retrofit: https://bit.ly/2Ee6GHn
More free programming courses:
- https://bit.ly/smy-list
Check out my website:
- https://bit.ly/smartherd
Let's get in touch! [Sriyank Siddhartha]
LinkedIn: https://bit.ly/sriyank-linkedin
Facebook: https://bit.ly/smartherd-facebook
Instagram: https://bit.ly/sriyank-instagram
Twitter: https://bit.ly/sriyank-twitter
Github: https://bit.ly/smartherd-github
---- Thank you for your love and support ----