Add Signature Collector with airSlate SignNow
Do more on the web with a globally-trusted eSignature platform
Standout signing experience
Robust reports and analytics
Mobile eSigning in person and remotely
Industry regulations and compliance
Add signature collector, faster than ever before
Handy eSignature extensions
See airSlate SignNow eSignatures in action
airSlate SignNow solutions for better efficiency
Our user reviews speak for themselves
Why choose airSlate SignNow
-
Free 7-day trial. Choose the plan you need and try it risk-free.
-
Honest pricing for full-featured plans. airSlate SignNow offers subscription plans with no overages or hidden fees at renewal.
-
Enterprise-grade security. airSlate SignNow helps you comply with global security standards.
Your step-by-step guide — add signature collector
Using airSlate SignNow’s eSignature any business can speed up signature workflows and eSign in real-time, delivering a better experience to customers and employees. add signature collector in a few simple steps. Our mobile-first apps make working on the go possible, even while offline! Sign documents from anywhere in the world and close deals faster.
Follow the step-by-step guide to add signature collector:
- Log in to your airSlate SignNow account.
- Locate your document in your folders or upload a new one.
- Open the document and make edits using the Tools menu.
- Drag & drop fillable fields, add text and sign it.
- Add multiple signers using their emails and set the signing order.
- Specify which recipients will get an executed copy.
- Use Advanced Options to limit access to the record and set an expiration date.
- Click Save and Close when completed.
In addition, there are more advanced features available to add signature collector. Add users to your shared workspace, view teams, and track collaboration. Millions of users across the US and Europe agree that a solution that brings everything together in one unified workspace, is the thing that organizations need to keep workflows performing smoothly. The airSlate SignNow REST API allows you to integrate eSignatures into your application, website, CRM or cloud. Check out airSlate SignNow and enjoy faster, easier and overall more effective eSignature workflows!
How it works
airSlate SignNow features that users love
See exceptional results add signature collector with airSlate SignNow
Get legally-binding signatures now!
What active users are saying — add signature collector
Related searches to add signature collector with airSlate airSlate SignNow
Add signature collector
hi everyone so welcome to our talk and today we we'll be talking about talking for 9x 35-40 minutes on flow in the reactive world so before i jump into the slide itself i'm talking about flow uh let me introduce myself so i am a google dev expert for android i am a speaker blogger and mentor i am also an open source contributor and i am also one of the core contributors for government of india's contact racing app and currently working as a senior android engineer at 1mg so with me is my speaker co-speaker himanshu and i would like to come him to come and introduce himself hello everyone so i'm a manchu i'm also a google double expert for android i have been into speaking for quite long i've been blogging as well apart from all of these i like to build open source libraries more or less and i work as a senior android engineer at roomie so even before starting anything today let's first understand what the agenda is for the talk so the agenda what we are going to discuss here is understanding the core problem which we have while designing an android app or let's say writing an android app so first we'll discuss the problem which we have in our hands second how cut core routines and flow actually solves it for us so this might be a very new topic for a lot of people but we are going to explain you guys co routines as a basic thing and then we are going to discuss how we can use flow alongside core routines then we'll also understand an internal view of how kotlin flow is actually designed we are also going to discuss on a very generic level how core routine is also designed but this topic is actually designed for kotlin flow so we are going to focus more on that part and at last let's say that if you're using any other property let's say rx java or you're even using the core threading model we are also going to help you and understand how we can actually migrate to cotton flow alongside using co routines and many more aspects to it so this is going to be more of a practical learning just rather than just going through a talk so over to niharika now thank you um now i before now before i deep dive into the aspects we mentioned in the agenda itself uh let's start with a very basic concept or i would say kind of style of programming and the pieces on which we decide to opt any framework or library or any component so uh we've always heard about this synchronous and asynchronous kind of execution and i think most of us are familiar with the term itself and why this type of programming matters in the world of technology or software so uh in simple words uh synchronous means connected or dependent in some way uh we wait for one task to finish before moving on to another task so so it's like going line by line and blocking the next operation until it completes uh here we can imagine executing one thing at a time uh let's have a look at a very basic example uh a kind of real world example we all do have a login screen in our app and with any username and password we will be uh doing the login now uh maybe uh you need a key like user id to do another operation like fetch user details for a particular user now now your execution will happen line by line uh seeing this uh looks super simplified code we don't have to worry about our application being in another state when our response or from a server is received uh but our screen is blocked because and being a user uh even i won't be happy if i see my screen frozen or just loading something and i can't do anything with app itself uh now as many uh if if we have many synchronous polls uh on our screen it appears like a long response time and ui is blocked until the resource response so this kind of uh this is a kind of bad uh for our application uh so what we needed here was uh continuing with other tasks till the time uh that particular task that gets completed and it may just notify us when it's com it completes to again focus on the next operation uh also imagine your device with a low network it would be uh like a laggy application then so uh if i have to summarize the drawbacks of this approach uh as we discussed in the previous slides as well if there are a lot of time consuming lines of code uh your application will become much slower to respond i may define this as a responsiveness aspect of any application and if i talk about uh performance so performance is something which we all care about it has been uh seen that while executing a request around 70 or 80 percent of time gets wasted by waiting for the dependent tasks so that is again bad in terms of experience as well and uh if you are doing everything on main thread itself and as there is no way to change threads then you may have seen the network on main thread exception uh also or ab not responding to this kind of this kind of stuff so it shouldn't happen right so you to utilize the resources as much as we can and make our app responsive even when some task is in progress and other things can be done in parallel uh like an asynchronous style of programming uh that kind of approach was introduced it's like executing multiple things at a time again in simple words we are doing something in the background like downloading heavy files or uploading some prescriptions etc now if i talk about uh specifically about the android world uh we have some options uh us to adopt this kind of programming approach as uh and if we we have to take care that if one uh once the task is done we may have to communicate to our main thread or uh view for other operations as well as while deciding uh those options so one would be the traditional approach well we have like the threads itself i have seen uh them getting used in all sort of instances however they are limited as android doesn't really allow ui updates on the background thread you may have alternatives uh with it but but again more work also if there are many tasks to execute one thread per task can pose uh memory is exhaustion and reduce performance so it's just like we mostly can use it directly for one shot operations again and if we check this programmatically uh we'll find much overhead in terms of size and uh the context switching etc then of course we have alex java uh in the last few years reactive programming has taken some momentum not only for java but for other platforms as well so the whole concept revolves around observer pattern we can manipulate threads easily using observe and subscribe on there are different operators like merge zip map flip uh flat map filters for controlling the data streams and also there are some callbacks for making the completion or some error in between the even flow but yes we have to manually take care of cleaning up any resources which we acquired and hell of callbacks here again and also we need to have a good learning curve to understand all these subscribers observer pattern in depth then this async task everyone's favorite uh i am just kidding uh this is deprecated as well the learning curve was pretty much easy with it uh adding our code and the two in the background is all it takes to transfer a long calculation to another thread but uh and the other methods allow us to handle a lot of simple use cases but again uh handling the configuration changes multi-threading parallel execution and the risk of memory leaks for the class giving using tasks is there so if you haven't read about uh till now that uh why am i talking about this configuration changes or memory leaks i would say please have a look for this for that advantages and the reason for the depletion as well now uh this one is my my favorite uh and i think most of us uh right now so it's scotland core teams we'll discuss it in more details in upcoming slides so these are some of the options not just the only options like we have another options like handler even even uh bus etc but even with handlers uh they again deal with threads and have some kind of limitations so let's deep dive into core routines uh the concept of the concept is not new in with android uh you may find it in many other languages like python go etc but now the question arises how are co routines helping us in a synchronous approach why are we following it why are we using it and what exactly is the advantage we have by using it so as per the definition codeines are lightweight threads by by lightweight uh it means that creating coating doesn't allocate new threads instead uh they use the predefined thread pools and scheduling for the purpose of which tasks to execute next and which just uh take up later so and quarantines uh internally uses thread pools uh behind the scenes uh like thread uh they can execute tasks concurrently uh they are not bound to any uh bound to a single thread and instead the codelink core team uh quote in runtime uh if uh we have uh which actually determines where when and where code routines run so they are cooperative as uh as uh we have this in the name itself co means this cooperative so this signifies if the quorums will be blocked or like doing some heavy tasks then they may be suspended uh they can suspend their its execution and the run time uh coordinate runtime finds another core game to execute in its place so as a result they can achieve a higher level of concurrency because a single thread right now can run many cool pins with just small memory usage and i i would say uh that isn't just bytes uh if i compare to thread uh if uh if uh i compared to thread theirs uh they are like i think using uh 1mb kind of uh stack uh size uh for them uh and also the context switching is kind of now replaced by suspension and os don't doesn't need to interfere for any kind of scheduling part among core routines now above all um well like some convincing points for how core routines are better than other approaches uh let me add some more reasons to use it so um this is again the same example we saw when we discussed the synchronous approach now uh but what if the writing is seen as easier uh as it looks in the synchronous programming approach like writing everything sequentially but leverage the our synchronous way behind easy to understand and relatable and any one of us can easily interpret what is getting done here not looking at different classes or like how the callbacks are coming up and what is the actual flow and if i have to pick this kind of solution i would definitely go for it and now uh let's uh you can see what uh or what all minimal changes we have to make to use it like this way uh so both the functions we are calling we will be adding we have to use use this suspend modifier and we need to launch this particular block uh in a scope like this that's it so not many changes and we have preserved our uh synchronous but yet sequential approach here so uh we saw suspend modifier getting added what is that so uh as as when we talked about the definition for core routines we mentioned that they can suspend themselves instead of staying blocked so suspend functions help helps us out in this process uh it's a function which can be posed and resume at a later time like uh we are ready with the result for that particular task and as you see um they have the similar syntax as we have for the regular functions not any fancy work here and you just need to have this suspend keyword added so this tells a compiler that this function needs to be executed inside a core routine they hold the property that says a suspend uh can only be suspend function can only be called uh from another uh suspend function or within a core routines itself uh we can't we can't call them from anywhere then we have something like coping scope like we saw this launch in the example above uh they are these are just an exam extension of these coding scopes so uh scopes are just nothing but the restrictions i would say uh within which the proteins are being executed uh so basically helps us to predict the life cycle of the core rings actually uh it's like when the scope is destroyed all the running jobs inside the scope which uh uh they will be cancelled or destroyed uh it's like if someone has used alexa you may recall or compare it with a subscription uh there uh we may we may use different scopes like global view model scope life life cycle scope as well uh but we should avoid global scopes as much as we can if we understand the definition itself you can relate as it is something related to life cycle of that particular core routine so this will introduce a concept here name structured concurrency uh so they don't uh really have to care about kind of leaking jobs for their proteins flow etc now um we understand the basic functionality and every time uh we are dealing with core things uh we'll come across these uh keywords and terms but now above all uh did you ever think that how exactly the is the magic happening we just added this uh spin and launch how how are the things working behind the code how the compiler is working under the hood so then now the magic revolves around this only reason and that is you are suspended uh let's analyze this through a very my favorite login example our favorite login example so we had this login and fetch your user details methods now having a suspend keyword with them and if you take a closer look um this getting uh if you see it's a and again i'm getting a user id and then through that after getting the user id i'm just using it another in another task so this is all like what we are handling through callback we were handing through callbacks if you remember in our hour in any other case so uh let's see now uh what happens exactly so uh so the cortland compiler will take suspend function and convert them to an optimized optimized version of callbacks and and the compiler itself is now writing the this hell of callbacks internally these are just callbacks backs and these are getting right written by the compiler itself for us when this computation we are doing in suspend so now we are free from this uh in the internal code you may find this method getting replaced with the having this continuation type added as a parameter this is nothing but just just again a callback so quality code beings call these callbacks with a fancy name that is continuation it's just a generic callback interface with some extra information added if anyone remembers the finite state machine like i said if anyone remembers i i don't remember exactly before i uh dive into it so uh basically it will be representing the generated state machine of any of that suspend function like uh what is the state now or later uh like when i initialize it that is a state zero then if it gets suspended then it goes to another state and if i have to resume it it goes to another state like state two then if i have to finish uh it will be going to state three so there is a state maintained there and uh this one this goes on for every method we have with suspend keyword and we call all this as a continuation passing style so this continuation callbacks are doing whatever uh the happening uh under the hood so these are just callbacks now uh if we look closely at this continuation interface it contains two things what first is the core routine context uh which holds the as context is always about some information itself uh it holds the information anything about the core team like when it needs to run any state or any errors then uh there is a function uh named uh resume which resumes the execution of a suspend function at a uh at it takes a parameter uh and that could be either the value of any computation that causes the suspension or it it could be any exception um i would say in in other words uh this param holds a value that can be passed back either successful or response or a fail result so the compiler is replacing the suspend modifier with the extra parameter completion of type continuation in the function signature uh which basically we are it is using uh for the communication and the result for the result of suspend function or to the core routines uh that we that that called it basically uh from kotlin 1.3 onwards um you can also use this extension functions resume and with the parameter and this resume with exception uh these are nothing just specialized uh versions of the resume with which we discussed uh in the previous slide uh yeah so this resume basically resumes exception of the course corresponding core routine ah we have this passing value as a return value of the last suspension point and this uh this another function this resumes the execution of the corresponding core routine with the with the exception which is getting re-thrown right after the last suspension point uh as its names also signifies that it uh it holds some exception so now we can very well relate this with callback style of programming where you have some methods like on success and non-failure so nothing is magic everything is done uh the same way but now the compiler is handling it much more efficiently and we have less boilerplate code of course uh now again let me brief the benefits we got by using core routines uh lightweight no it was scheduling no complex switching over that as it is now handled using suspend keyword less less boilerplate code and of course the ease of understanding through a traditional way of writing code that is sequential but with an advantage of running the code or synchronously and i can say this as clear non-blocking and a linear code what we got uh now i have mostly heard this comparison for core teams versus rx shower i would say it's a partial information which we always consider while you're working on these as we saw in the examples above using suspend keyword uh these are just one short operations like anyone has if anyone has used uh rx you can you have seen this single complete table or maybe calls uh so this is just uh you can compare it with that we are just having a simple network call uh one shot operations like those kind of calls uh now let me give you a scenario let's say uh you have a stream of user clicks a stream of location updates uh our application which is listening uh or a stream of network updates we are we are we right now have subscribed to so for these kind of operations we can't just work with core teams or suspend functions uh like in rx uh if you uh remember we have observables and flowables for this kind of work so uh what we can do here so one important thing uh i would like to highlight here is uh core routines is just a scheduler part of rx as well and also as whenever they are launched using this launch or any other function to start a core routines countings are hot and even hot is the reason they are not just a replacement for the reactive streams itself uh now core teams can't alone handle this streaming of operations uh there was a need of something else here and that something is how flow comes into the picture and if anyone has to really compare with alex i i would say something like this that both core routines and flow with their single shot and multi-shot operations and reactive stream handling itself actually does the whole whole work of rx but don't get misled by like this now we need to learn how to use both uh i would say that's pretty much easier and if you have to compare the benefits uh it provides and of course the benchmark uh which i saw in a summit i guess uh like there was a benchmark for uh for a app named scrabble uh where rx methods and operators took twice the time for the work that can be done by the by cotton coatings and flow so lesser time better performance lesser code and ease of understanding as well so there are many reasons to adopt it here uh again to summarize the benefits kotlin provides null safety in the streams uh which basically means we can't sell send null values in the stream uh you you uh it's also there in rx server as well and of course uh you can use flow with any other reactive stream uh libraries we can have we have uh very easy to understand apis to convert flow to any other reactor streams uh we may cover some conversion uh today is with then we have some amazing operators like we had with alexa we don't need to worry about that and even uh you don't really need uh some of the operators now as some magic is already getting done through the suspend and core routines itself but but the most frequently used like map filter uh etc uh these are there and also um there's only just one single operator for both synchronous and uh synchronous approaches so we don't need to remember more operators to work with uh so again life is easy um and while using flow you don't need to worry about the back pressure handling so so the back which is something when uh when the rate at which the producer is emitting values is more than a consumer can consume at that time uh for that now no special operator of code needs to be written this is already handled internally and of course using the suspend magic you may read about buffer operator also when you deep dive more and also the latest operator to get the latest value on the during the consumption also uh flows are just similar like a list or collection but flows are cold which means that they won't produce values until someone has subscribed to consume those values um even all uh all the flow operators are also cold you may get to know more about the terminal operators we may use for collecting these values uh in the upcoming slides now um as we see kotlin multi-platform isn't high like for using it for hybrid kind of apps so so that support of all core teams and flows with km is already available and and even with other uh quarter platform like jsjv etc so we have support provided already there now this was pretty much about the benefits let uh let's talk about some basic implementation uh so to create a flow we need to use a flow builder like flow flow off etc provided by kotlin to internally create the instance of a flow uh we can also use as flow if you want to convert any kind of collections or sequences to a flow uh here we have used this flow off to create a flow [Music] then we have this emit function uh to basically send the values uh to the consumers who are consuming those values and as we discussed uh that because flows are called uh they won't produce values until someone subscribes subscribes or uh in flow language i would say until a terminal operator is called so terminal operators are just suspending functions again that start the collection of the flow uh here you can see uh we have uses collect uh which is used for collecting the values and it collects values from a flow and executes an action with each item and we have some other operators also if you want to check like reduce first etc uh now i would like to call himashu to discuss more about the flow architecture internals migration from rx to flow and much more so over to you thank you niharika that was pretty much to grasp everything like the basics and even the core routines right so niharika gave a basic introduction how core routines works and how suspend functions work right we also got a very basic idea that how flow works right and how we build a flow in a very generic way correct now since a lot of good apps right now have been built using rx java right and uh let's say that when you need to migrate something of your code to kotlin why not start migrating your rx java code to flow as well or let's say just co routines anything but if you use if you're migrating rx to kotlin right and core routines and flow you need to have both the operators working together so this is this basic example how we are emitting one two three from an observable right this is an rx snippet and the same thing which we have is flow of one two three and dot collect so niharika showed one of the ways to build a flow that was flow as a lambda this is another way to build it let's flow off and inside collect what we are going to get it that's one two and three right so you basically got a very basic and a generic idea how co routine suspend works internally right but there's a new way and a new learning where we have to introduce cartoon flow internals as well so this is one of my favorite topics how cotton flow actually works so if you remember in the kotlin core routines there were a couple of options coming up we used to decompile it on a jvm part then there was a continuation callback which had resumed context and apart from that we also had two extension functions we had resume and we had resume with exception so one was for a success callback one was for any error right can flow is pretty simple as i have to say this so this is an interface of flow right with which you have as in generic type notice here that you have a collect suspend function correct and inside that you have another something called let's let's not introduce this as of yet this is something called flow collector so first we have a function which is already suspended it's called collect and just to see what we have as a flow collector it's another interface and that function has emit so if i go to my previous slide this one so it's basically an interface flow which has a suspend function called collect which also has another interface called flow collector right and flow collector has a suspend function again called emit so basically when you have to think of flow on a very generic way or a very on top of your mind you just have to think cotton flow as two things it just emits and it just collects a value that's it that's pretty much what cotton flow does and when you use cotton flow it it is so binded in together with cotton core routines that if you see both the functions here emit and collect right both are suspend functions here so it actually works in the conjuncture with core rotates itself and you can't use any of the flow operators or any other stuff without using it with the core routine right so let's understand if you have let's say a legacy code of rx that's rx java one or two let's consider for now it's 2 and we want to convert it to a certain newest set of code with core routines and flow just a suggestion i am showing this but that doesn't mean that you have to migrate it like a learning which i got from my and if your code is working fine don't just migrate it because it's very fancy just let first check if it's there is an actual need to migrate something from rx to flow or not right so first let's see what we have so let's say that i have i have to do an api call which where i have to fetch a list of people correct so i have my username sorry i have my point api v2 user search i have a certain query which i have to pass on right but if you see that we have an observable which like as a return type right so that's pretty much if you have to understand that this is a return type of an rx type right now i am going to migrate this into a flow callback or a flow return right to make that you first need to remove your observable and you need to add the suspend keyword here that's it like you don't have to do much much other stuff and next let's say that we use repository pattern right so first we have a repository where we have a function like this fetch people which takes page and the query and it returns of a type flow so if you remember in this code we had a response of list of users right but here in the repository [Music] we have something called flow op response of list of users so basically when we are going to implement this we are going to actually return the flow of that whole specific data so when we work in repository there was a recommended way that you should not use live data in the repository patterns correct so that is where flow comes into the picture and it binds it very perfectly so if you have to do let's say a db transaction in the dow or let's say you have a repository right so you don't have to use live data there as a return type rather use flow and this is it now when we have that same thing in our repository implementation we return something of observables right like how we have it right now and the user api let's say if you are injecting it via the constructor or let's say not even injecting it on a very basic term if you're passing it by the constructor right the api service let's say let's call it user api i'll just call user api.fetch people and i'll pass on the parameters right that's how this would work but in the terms of flow you would not just return user api.fetch people rather will actually build up a flow now here you can see we are returning a flow builder here inside that flow builder we are actually emitting user api.fetch people and we are flowing it on dispatcher.io so basically it's running on the i o thread and it's emitting here so let's break this down in a very generic way first as a first step we built a flow which we have to return right then we are emitting on the next step where we are emitting the user api which we are using in the observable but now here we have created a suspend function which is the fetch people and at the last i'm running it on the i o thread and that's pretty much it now as an extent what we need to do is we need to go to the view model and we are also passing that helper or the repository in the constructor right so now we need to do that fetch ap fetch people api call so as part of the ktx library of android we have something a go routine scope called as view view model scope so it's an extension function which is specifically used for kotlin co uh cotton view models sorry android view model and this we are going to launch and since it's a suspend function and if you remember from our previous talk it says that to run a suspend function you actually need a scope so that specific scope here is the view model scope which we are using so inside that we are going to call fetch people and we are going to pass whatever parameters and the queries we need right so this was the first scoping mechanism which we use then we do that api call fetch people now let's say if we get some error some throwables right so that comes inside that catch and here we'll get a throwable when we get a throwable here we can use it to respond or to just show the error message to the user now inside that collect what we'll basically do is we'll get that successful response as a lambda and then you are going to use that successful response you can pass it to the activity or the fragment let's say via a live data or a mutable state flow or a state flow right so now you can see when we built this part right where we are using the flow emission builder we don't technically do that we actually create a wrapper to do an api call and inside that wrapper we just pass on our act our api service calls right so that's that's one of the aspects how you can convert an rx java api call using core routines and flow now let's say we have a library a very famous library on github called rx bindings where everything is converted into the alex java mechanism right so now let's say that if you have to convert something into a flow for example you can actually convert a click listener as a flow as well but let's let's see a very basic example here when you actually do add text change listener right we actually use it a lot when let's say that a user is entering some sort of a text uh coming up in the edit fields we do a lot of things like that right but in my case what i need to actually do is i need to convert that whole thing as a flow so to convert it we use the callback uh extension or callback lambda callback flow which would help us to convert the code the or convert the callback as a flow so inside this we'll do the or we do all the calls of add text change listeners and we do the inputs so basically in a generic set what we do is we always need the code which is coming from on exchanged basically whatever new text is being entered right so we use this offer which actually in a sense means we are emitting that result so here in this case it's p 0.2 string so basically we are offering the string sequence which we are entering to the edit field and after that when we have done that offering and it's done and it's converted from the callbacks we basically close it so to close it we use await close so that's how you can actually convert rx java to a controlling core routines and a flow code as well as if you want to use flow in your project how you can use it so now we are going to learn as a flow as a data holder and this is something which niharika would be taking you forward so over to you have yes uh so uh if you remember we have been using live data for all the data updates and that to uh the latest value itself so live data acts as a observable data holder and of course lifecycle aware but with live data there are some shortcomings uh as it is found with android platform and if you have to use it in repository or i would say some data layer or also the domain layer which ideally should be a platform independent thing uh or just a pure java it should be a pure java or cotton module um so it's something we should avoid and if you ever get a chance to see how live data transformations work so whenever we call any map like operator so uh with this live data so what happens is the lambda which we called on the main thread itself so if you ever get a chance to see the internal code you can check that uh so so it shouldn't happen right uh we never told it to switch to the main thread uh and if uh as i i told you that if you look at the internal code it takes a live data source and adds it to a mediator library so now again this uh live data uh has now become an observer for the new values to perform a map function over them and if you look at the documentation itself uh it says that live observers are always called in the main thread and if there is some heavy competition we are doing here then you can imagine the performance compromise so uh this is how the transform transformation for a map operator are written with it uh so what alternative can be used and even when we are already leveraging this scotland core routines and flow uh is there any anything which can be used in as an alternative or so you just need to learn just the concept of this core routine or you don't need to learn some new concept for any new component library or a framework so um but uh uh with with the default content flow we can't achieve uh this because flow is stateless uh it doesn't contain anything something like uh dot value and it also doesn't know anything about android lifecycle or and it doesn't provide a kind of automatic posing or resuming of collectors uh upon any android life cycle state change is happening and of course it is also cold so flow introduced other apis uh to optimally um emit this these state updates and emit the values to multiple consumers as well and one of those apis is a state flow it's a state holder observable flow that emits the current and new state updates to the to all all of the uh collectors uh now like live data we can also have a dot value kind of thing introduced with flow uh in this api state flow and now uh with this now uh the flow is stateful in this case so let's look uh how uh it works you may find many similarities here with live data uh like we were creating a mutable live data for doing any kind of manipulation or mutating or changing any values we have mutated mutable state flow uh which we can set values to the flow then uh you can see uh like whenever we have to pass anything to our uh live data itself the to the view itself uh we won't be exposing any kind of mutable light data uh so that uh and to avoid any kind of side effects we will be exposing the state flow or to our ui layer so that our value hampering is prevented so uh we should always uh be exposing this live data only now whenever we set value uh like this the consumer who is consuming this value uh will be consuming it using the collect operator uh will it it will get the value with this collect every time uh there is a change in the state so working is pretty much like the normal flow itself like collecting the values but now um it is like listening for the updates and uh updating the ui itself so inside what happens is um this value in the buffer is always the latest value sent to it and the values that were received by someone uh won't get uh lost so state flow works on a concept of uh so it also has this uh distinct until change kind of thing already implemented so and it will always return you this updated value as it will filter out the same uh and also it filters out the same value uh and also one more thing to add here so state can have more than uh one we can now use uh more than one collector and it can commit the value to all of them so stateflow becomes uh active as soon as we create uh created and they are hot in nature we can access the state flows value without even performing collection and and state flow is always active uh and memory and it becomes available for garbage collection only when there are no other references for it uh uh before uh for for for the before the garbage collection so uh this is in brief about the state flow and now to conclude the talk here you see that uh how rx java we can leverage both uh both the uh both the advanced vp had the advantages from alex shaw and both how qualities and flow are helping out here with a easy flow then of course this uh core routines and flow supports kotlin multi-platform uh as it's a kind of future uh thing now then we have uh so as we saw we talked about the threads and core routines itself so threads just takes kind of just uh taking size and pipes itself uh and if i talk about the threads uh it is taking kind of a mb 1 mb size itself so it's it doesn't impact the size of the app much [Music] and yes go with the flow as you can now see the advantage it is providing to us and thank you thank you for listening uh to this talk and also uh we tried to keep it like we we never wanted we always wanted to have a talk like we want to listen like having all the kinds of kind of things covered uh from the basic how core teams uh core teams is helping out uh with us approach and how is it easier to use uh in terms of uh if if we have to compare with rx and then how flow comes into the picture so i hope uh we hope that we uh we justified to this talk so thank you and thank you everyone for having us here let's see whatever questions you have we can answer you right here and if not you can connect to our twitter handles as well to ask any questions if you can thank you so starting off with the questions i'll start from below so there's a question what about different rx operators like debunks etc can we do them with the flow so yes there are a lot of uh operators which are present in the flow which you can use alongside it so yes debones i have used for implementing a search query result in flow and you can use it and also one thing to add here uh so we always whenever we are having this kind of such kind of functionality or autocomplete so we use this distinct until change so even with spatial kind of thing you will find it automatically added up there so you don't even i think you don't need to even uh add it you may find some kind of lint warnings suggesting you that it is already handled so is then we have this so uh can we use custom thread pools in core routines if yes how um i think you can use it uh there is some kind of new uh you have this new fixed thread pool context kind of thing and you can pass a fixed set of threads uh to be used for your courtings so you can use it there what is like the next question is what is the suspend key what is the suspend keyword and what it i just said i missed it out and what it is used for beside login so basically if you want to execute anything inside a scope or any koru team you definitely need to convert that in a suspend keyword so basically any task which you think might take time should be executed along with the suspend keyword if something has to be executed inside and the core routing scope yes uh then i have read that starting up core piece for the first time is much more expensive and can affect app performance any thoughts on that i haven't seen a kind of benchmark like that this uh i have seen it in an opposite way like it's a kind of faster kind of home and even if i compare to any other thread kind of stuff like if i'm i have implemented something in the threads itself and if we call core routines as lightweight threads then i would say uh it is taking much lesser time there so i don't think that it is taking much time [Music] so there's another question what's the key difference in callback and callback flow and channel flow uh so considering this like callbacks are often used for converting callbacks to a flow channel is more of a sequential execution which you have to do so if you have to consider that you can think it as as of that way uh we have will there be a new thread pool per coating scope i would say uh for a for one function i'm calling the for the inside function i think there is one only one thread pose and even only a thread itself can manage multiple core pins so uh i don't think for that kind of broke uh there will be a new different uh thread pool for uh for different fun again different classes and different functions there there can be but uh even a single thread can handle different core teams itself uh multiple core routines itself so i don't i i don't think this isn't optimized uh there should be a kind of just uh from from a thread pool itself there uh there are even a single thread managing multiple routines okay there's another question saying is having live data on a repository layer a bad coding practice while using mvvm it is like a way which has been mentioned by a lot of devs around that you should not use live data outside of your uh view model so because basically it works with the view in the conjunction so you should not be using live data let's say with your db layer or let's say your repository layer that is why flow is very smoothen out that process of using a flow there and just passing on the data to the view or the like the fragment of the activity wirelife data uh next question question we have how to debug a synchronous code written using core teams i would say yes uh debugging asynchronous code is difficult but uh what you can do is you can use the blocking kind of functions or like run blocking or even you can write this but you can have uh run blocking or async and then kind of some kind of uh what i do when i i am debugging kind of corrupting kind of work uh putting that code the same code in the run blocking or sync or having some kind of uh logs there are added so you can uh try like that okay uh so our question is anything special we have to do for android data binding i think with android studio the new candidate build they have started supporting state flow with data binding so i don't think anything special you have to do but i'm not pretty sure but they have started supporting with a canary build so it might take time to be stable yes but they have started supporting it uh is core routine same thing as thread pool uh no uh it uses thread and then again even if uh it it is not like a single thread itself it's a kind of special kind of version of thread itself uh like we say the lightweight threads uh but it is it is not similar a kind of thread pool it uses a mechanism that is thread pool uh inside it so to manage all kind of core routines itself so yeah right does flow provide alternatives for single computable maybe so basically when you use uh core routines and flow together you can actually replicate the whole execution flow of single completable and all of that uh in this execution but individually flow doesn't support it flow has to work with core routines to do it okay uh what is the difference between flow and light data kind of android dependencies again in the in a pure java or cotton module uh if you are writing kind of by the preferred architecture just to separate all the business logic and kind of frameworks or dependencies or the android framework itself so uh you shouldn't have these kind of stuff in your domain layer or data layer uh this uh repository itself and uh for flow and live data so uh as we talked about some of the things which we can't have with so it's not exactly a difference between flow and live data uh it's a difference between state flow and live data so uh flow is just like again the core and you can't just have a stream uh listening uh listener kind of stuff with state flow you can have and as we talked about the live data disadvantages like uh like if you are using kind of map kind of functions uh with it you may be uh doing some kind of operations on the main thread itself so and uh even if you are not switching any kind of thread there so these kind of they are even more limitations to more shortcomings here so uh that way flow or state flow uh will work uh in in a much performant way so yeah we will be using state uh there so another question is could you provide a reference project so you can definitely check out a lot of github projects there are like you can you can actually see how to use flow and if even on cartoon github's profile you can see a good projects and good references out there yeah um how do you ensure that a mutable state flow stored in a view model uh restore its current value correctly after this so it's it is not related to i think uh view uh this state flow or anything here uh we have provided some kind of now state handle kind of thing with view model uh which can handle the confirmation changes as well as a process dip so whatever inside we are using there we can save and restore the values using state handle if i am uh taking this question in a correct uh with if i am understanding the question in that form which you have written so uh you can uh so it's like uh related to the view model itself uh view model uh can have this state handler kind of thing and you can restore the values from any if you even if you are using live data you can restore that live at a value the same way you can store restore mutable state flow okay uh another question i see is can we send data in batches using core routines and flow i don't exactly understand what you mean by send data in batches but you can actually execute a certain chunk of data using kotlin in fact to send data's there so if that's what you were asking i'm not sure with the question here why do we want fetch people to return flow instead of being a single suspend function so uh this is why uh flow was introduced because uh suspended can have just a single shot of operations like i just wanted to do a login kind of operation so i can i uh i can use core routines this uh bunch of operations with using suspend function but if you are uh listening for like uh fetch people i am just fetching it uh again and again for reactive stream like you have kind of pagination kind of stuff or uh maybe uh so uh there is a kind of list uh or maybe user details coming up a list of users again uh you're uh scrolling your screen uh these kind of stuff if uh it is there uh so it's a kind of reactive stream so that can can't be handled through system function you have to use flow there right there otherwise can we use dagger to a coin with state flow and core routines i don't understand again this question but yes you can actually use target 2 or let's say any dependency injection framework when you're using core routines in your project so that answers your question uh yeah i have used coin with co routine so you can use uh any dependency injection with it i even uh i think it isn't any kind of dependence injection framework is not related to uh using uh with it it's a kind of again architectural level thing so you can use any kind of stuff there what is uh the pro provided alternative for single compatible and maybe in rx so these are already handled to suspend uh uh coco routines uh if i talk about a single compatible and maybe uh the part which we had to do for reactive streams the observable and flowable that is getting handled to flow so it's it's about core means plus flow uh so half of the part is already handled uh through core routines uh the single maybe and completable uh kind of uh same work you can uh have through uh the suspend functions and uh all kind of observable observable kind of events uh you can have through you can do through this okay another question and maybe this is the last question because we are running out of time so how is error handling in flow like does it have something like an exception handlers so basically if you get any sort of an error apart from your response error like when you get something from your back end so first error you can everything can be caught inside that catch block so that catch block returns a throwable and any type of specific error which comes up you can get there and let's say if you're managing a response in a state of legitimate response ie results or anything you can use that inside your collect and let's say if that query parameters were not successful and some error were thrown you can get that in that specific set so majority the catch block is responsible for handling your exceptions here i think uh maybe we can actually use uh other questions on our table because we are actually running out of time thank you so much everyone thank you so much for asking a lot of questions and i i would be around me and harika so you guys can ask any questions and directly there yes thank you and thank you so much you and erica
Show moreFrequently asked questions
How do you sign a PDF with your own signature right from your computer, without any printing?
How do you indicate where to sign on a PDF?
How can you sign your name on a PDF?
Get more for add signature collector with airSlate SignNow
- Add electronically signing paper
- Integrate digi-sign Birthday Party Invitation
- Copy byline Graphic Design Proposal Template
- Rename electronically signed Job Quote
- Pass electronically sign IT Services Proposal Template
- Repeat electronically signed Letter of Intent Template
- Champion digisign Transfer Agreement
- Require countersign Arizona Rental Lease Agreement
- Call mark Modeling Agency Contract Template
- Solicit esign Commercial Invoice Template
- Notarize Sorority Recommendation Letter Template esign
- Move Collateral Agreement signature block
- Create Real Estate Development Proposal Template signature service
- Accredit Leave of Absence Agreement email signature
- Warrant Art Camp Registration signatory
- Assure Service Quote Template initials
- Request Distribution Agreement Template byline
- Ask for Professional Physical Therapy esigning
- Fordbid Professional Medical History digisign
- Expect signed date
- Ratify caller ssn
- Commission roomer zip code
- Buy Succession Agreement template initial
- Affix Cleaning Quote template signature
- Write IT Consulting Agreement Template template email signature
- Ink Cancellation of Lease Agreement Template template digital signature
- Acknowledge New Transcription Project Form template electronically signed
- Ascend Plumbing Contract Template template byline