Hello, in this video, I am going to show you how to send parameters to your kotlin file in your Android project from flutter. So I've already shown you in the previous video, how to actually call a method from your kotlin code. If you haven't had a look at that feel wreck, I highly recommend that you go through that video first. And this is why resulted in I click this button says hello from the kotlin world and that is return from here to certainly send values is actually pretty darn simple. What you want to do in your dots on it put raw, not equal to string dynamic. So long then here, we just put the actual key so this is the key date.
This is the validate type making dynamic means we could pass in a number we could pass in a string. You could Get it to an integer. So number for example, that's totally up to you. And bombs gonna send you two strings. Just keep it simple wherever you want to do on the cotton side is totally up to you on both Val one hold on and here on the put just put the number one in a string. The only thing we need to do not dodgeball is they send maps the past they don't pass this in as well go to our main activity Cockney.
And inside of here, what we need to do is first of all, we need to actually get the, you know the parameters of the method and that's part of the method call to do that with Val. Arguments equal to method call dot arguments and we just put map Green na is that of you know dynamic in kotlin and we pop into a bracket so this is the format and then we've actually got all of the arguments. Now what we want to do is actually check for a particular argument. So we are going to say Vol. vow one is equal to arguments. And to get one you just do square brackets and then put the name and the name is whatever you specified is the key, key and value.
And now this has a string one in it because those number it is still inside of the screen. Now what we can do is include if there is equal to string one, then we are going to do a result dot success. Yay. Though dot dot success. And I'll get rid of this one. Yeah.
So if we pass in the value one, which we ought to return, yay, if not your return name. So remember, because we are modifying the Android native side, we need to shut the application down and restarted or, you know, read the book, because he will not build the Android side. If we just do a hot reload or a hot we'll start again, it just takes a bit of time. But you're probably not going to be doing a whole heap of no native kotlin or native Java side, you know, code. So if at the end of the world let's say that Okay, so, so, if I click this button, we get Yay. So we get this year and cut it is the one you want to tune in here.
And I just do a hot reload. And I can do a hot reload because this modification was on the dark side and not on the kotlin. side, we should get you get an A, because the if statement only checks for number one equally multiple checks. And you can have multiple parameters as well you just change the key, which remember is this part. Yeah, that's it. That's how you send parameters from the flutter Dart side, all the way to the native kotlin.
Side of your Android project. Not much more to it than that. If you have any questions though, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.