Dart Tutorial 2021

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

If you don't know Derek, he makes great succinct tutorials for a big range of technologies. He also recently put out a Flutter tutorial.

👍︎︎ 3 👤︎︎ u/n2fole00 📅︎︎ Jul 18 2021 🗫︎ replies
Captions
well hello internet and welcome to my dart video tutorial this is updated and i am going to be dealing a lot with flutter specific parts of dart but the whole entire language is going to be here and in the description i have installation instructions and i have a lot to do so let's get into it all right so everything is going to work the same for mac as well as windows you can see here i have visual studio that's what i'm going to be programming dart in i'm going to be using android studio for flutter so why don't i show you where to get that all right so if you want to get visual studio code just go to code.visualstudio.com and you can download it for all of the different operating systems and the installation process is extremely easy then what you're going to want to do is you're going to want to go and get the dart extension inside of visual studio code so actually after you open up visual studio code just click on these little boxes over here that look like tetris pieces and type in dart and then you're going to come over here and click on install and you're going to see a window like this and everything is going to install for you and everything's going to work now i'm going to be outputting everything to the debug console as you can see right here just to keep everything simple and to get to that you just find preferences and then go to settings and if you want to make your font bigger people ask me this all the time just type in debug console up here in the search field and you're going to see that debug console font size shows up and you can change it to whatever you'd like alright so that's the setup process now let's start writing some code all right so very first thing i'm going to do i'm going to come over here and i am going to create a new folder for us to work with so i'm just going to say file and i am going to say add folder to workspace and i have something called dart tutorial so i'm just going to select that and click on add do i trust the authors of this file the author is me so yes all right so i have my folder here i'm just going to select it come up here create a new file and i'm just going to call this dot dtut. like that hit enter and here we are you can close this down and now we are ready to program with dart all right very first i'm going to import our math library and to do so you just go dart and math like this and throw a semicolon at the end that's going to provide a whole bunch of different formulas for us and the reason why those squiggles are there is because it i'm not using it alright so that's it so let's get the obligatory type of stuff out of the way how do we do hello world everybody wants to know well void main is where the program is that is you're going to execute all your code inside of and you just say print and let's be different let's say hello dart instead and all the code here is also available and heavily commented in the description there you are everything all set up right there and if i run this over inside my console i'm going to come down here where it says debug console and here you can see it prints out hello dart over in the side in the debug console and you can just click on run right here to execute that if you'd like all right so we got hello world out of the way there's a lot more to come so basically variables are going to either be dynamic or meaning that you provide a value and it figures out what the variable type is or the data type is or explicit meaning that you actually tell it hey this is an integer this is a string this is uh whatever so in this situation i'm going to have it be dynamic i'm not going to define anything so i'm just going to say name is derek and you can also come in and be explicit and say string name to and still derek all right so there we are so you can either be dynamic or explicit one thing to be aware of however is once the variable type is set it is fixed so for example if you typed in name is equal to 2 that is going to cause an error because it is not an integer it is a string and will remain a string you are however going to be able to make what are called dynamic variables so we're going to say anything here but it is normally advised not to do this but just to cover everything you can now go in here and say anything is equal to and throw a string inside of it even though it is originally a integer all right so something to be aware of there maybe you've decided that you would like to let's get rid of this first like to create a variable but initialize it meaning give it a value at a later date in that situation you can just say late int and var1 like that and there are two number types as integers being numbers that do not have decimal places and there are doubles which are numbers that do have decimal places there are boolean data types and so we can have can vote and they can either have values of true or values of false let's say you would like to come in and find out what data type a variable actually is well i'm just going to use print here like this and i could say is bull like that and this is string interpolation which just means it provides a way for you to either put your variables or create calculations directly inside of your print statements this guy right here does that the dollar sign and the two curly braces and then we can come in here and say something like can vote is bull and that is how we can check if that is a boolean data type and you can see that it comes back as true there is no character type and one thing that's important to know is variables can't be null unless you declare them as a nullable type so to do that you can say this is int and i can just say something like i'm null like that and if we come in and say print like this and i'm null like this you can see indeed that it does get printed out as null and another thing is if you would like to define a constant you can do so so let's say we wanted to have pi inside of here 3.14 just to keep it simple and there you go that is how you define constants all right so after we talk about data types it makes a lot of sense now to talk about casting all right so let's say we have a string here and let's just call this snom is equal to and 45 and we would like to convert it into an integer well we just say int i num is equal to and then you go int and parse s num like that and now you have an integer representation of the string 45. you can also convert integers into strings so let's go and get s num is equal to we can go i num by just calling to string like this and that converts it back into a string you can convert strings to doubles so let's create a double let's call this dnom equal to and you should say double and parse so pretty easy to remember another thing to be aware of is if a value isn't valid it's going to return a null so let's go double and remember with our question mark here for nullable values d nom and 2 is equal to and we could say double and we could call triparse triparse is actually preferred to be used over just simple parse and we could do something like 1.2 and then throw in a letter okay obviously not good and with visual studio code you can just select everything put quotes around it like that and everything's going to work like that and if we come in and just to verify that what i just told you is true we will throw this like this and run it and you can say yes indeed it comes back with a null value all right so that is how we cast values and now i want to talk about some math all right so i don't want to bore you with having you watch me type this in basically we can perform addition subtraction multiplication and division and you can see exactly how all of those are going to execute right like that there's going to be a couple other additional math functions we're also going to be able to perform integer division and to do that you just go tilde which is in your upper left hand corner of your screen and total like that and you get integer division and you're also going to be able to find the modulus or the remainder of a division and if we run that you see the output right there another thing is useful is there is a shorthand way to increment and decrement so let's say we have a variable right here move it up here so you can actually see it here is a variable and we'll just call it n1 and give it a value of 5. now if we would come in i think i still have print here yes i do all right so if we would come in here get rid of this part and say n one plus plus we're going to increment this and n one plus plus right like that and then we would say this basically just means that we want to add one to the variable and one all right pretty simple however this causes a little bit of confusion let's say i come in here and i put the plus plus part let's cut that out of there throw it right here and again throw this right here and get rid of this now what output are we to expect whenever we would run this well what we get is five well you say wait a minute you said that whenever we put the two plus signs on there that it's going to increment it not in this situation when you put the plus signs after or i should more specifically say this what it's going to do is it's going to say what's the current value of n1 well it's five okay print five then after you print add one which makes this six and then in this situation the plus plus is first this says first add one to the variable n1 and then print that out and that is the reason why you get 5 and 7 here which might not seem logical likewise there is a decrement shorthand as well so we can just throw these on here these are fix and prefix incrementers and decrementers if you want the technical jargon for exactly what this stuff is and we can run it and you see here we get similar results now remember whenever i went and imported this library up here dart math well guess what dart has a ton of math functions here are the most common ones so what i did was i created two variables m2 and m3 gave them a two different values of course and you can see here that we're able to find even values let's go and run this you can see it side by side all right so we're able to find out if a value is even or not if a value is odd or not we can go here i multiplied negative 1 times this variable to get a negative value to be able to get the absolute value as you can see here ceiling is always going to round up to the next value as you can see right here it gets four floor is always gonna round down and round is going to round depending upon this value since it's four it's going to round down if it was five it would round up truncate is just going to knock off the 0.4 off of here as if it didn't exist and you can see here we're able also to compare different variable values and in a situation in which the values are equal it's going to return zero in the situation which the value on the left is and by left i mean this is greater than the value on the right it's going to return a 1 and likewise if the left one is less than the right value it's going to return a negative 1 as you can see it did right here we're also going to be able to find the natural log the minimum and maximum value of the two provided we're going to have a power function 3 to the power of 2 and also square root functions and then a whole host of trig functions so there you go a round up of the different math functions that are available another thing we like to do with math is to generate random values well to do that you just say random r1 is equal to new and random like this and then what we can do is just simply come in here and print and i'll say random like this and then i'll take my r1 and i'll say next int which means i want a new value it's going to be a random value up to the value of 100. like that and every time that i run it it's going to give me a different value see here it's 18 if i run it again you can see here that it's 79 and so forth and so on another thing is there are also some built-in constants inside of dart so let's just go and copy this guy throw it in here like that we are going to have e and we'll throw this right here and also we're going to have pi and i think that is the gist of what is most important math wise whenever it comes to programming with dart and there you can see are those values all right so there's a rundown of some math functions now i want to talk about some conditionals all right so with your conditional operators you're going to have equals 2 not equals 2 greater than less than greater than or equal to and less than or equal to you're also going to have logical operators which is going to be not if you put that in front of a true it'll turn into all false and put it in front of a false it'll turn it into a true and allows us to combine different var um conditional statements and or also does the same so let me just give you some examples here showing you at the same time how if else if and else work so let's say that we have an age i'm going to say age is equal to 8 like that and what we want to do is figure out what school this person should go to based off of their age well if the if statements and art work like this you say if age is less than five like that and curly brackets and then you define what happens in that situation so if they're under five we are going to say that that person needs to stay home all right so there is if statements now we can also say else if like this and let's use our logical operators here as well as our conditional operators so we can say if and you have to use multiple parentheses here age is greater than or equal to five and age is less than or equal to six okay so that is a way to combine those different conditionals and in that specific situation we're going to say that this person should go to kindergarten like that all right so let's do some more let's say that we would like to be able to find out what grade a student should go to well in that situation again we're going to say else if and parentheses important age greater than 6 and age is less than or equal to 17 well in that situation we're going to come in here actually this should be else if like that and get rid of this additional information here and let's take this and throw it up on top all right good stuff okay so we got that now in this situation it's going to be a little bit more complicated you're going to tab in here and say print and we can go and perform calculations directly inside of here so we're going to say grade like this and then we're going to say age minus five is how the math works and we'll be able to figure that out then by default if none of these are true we are just going to say print and college is going to be our output in that situation and if we run it you see that grade three comes back as our answer all right so good stuff another way of performing different actions depending upon different conditions is switch so with this one what i'm going to do is i'm going to say that there are going to be certain ingredients and based off of the ingredients i am going to define what the person should make for dinner all right so i'm going to say switch and ingredient so what this is saying is if the value for ingredient is equal to either tomatoes or pasta i'm going to tell them to make spaghetti all right so i'm going to say case but how do i do that tomatoes or pasta spaghetti well if you want to have multiple conditions you can say tomatoes like this put a colon and then follow that up with case pasta like this and in that situation in both situations actually we are going to say that we want to output spaghetti like that all right then afterwards you can type in break and if you do that it will jump out of the switch statement and execute any code that is down inside of here that's what break means i don't want to continue searching for any of the other things that follow now we can say beans is something we have and if they have beans we're going to say that they should make burritos like this okay and what do we need here we need another break statement now in the situation in which none of these are true let's say that we are going to recommend that something that's going to work for everybody and i'm just going to simply say drink some water for dinner all right so now what i can do is i can go and execute this and you're going to see spaghetti comes back even though i have tomatoes here and likewise if i type in pasta that it is going to come back spaghetti again all right so there you go there's some conditionals if else if else as well as switch and one more let's talk about the ternary operator now the way it works is it's going to assign different values based on conditional results so let's do our can vote again so i'm going to say can vote the value of can vote is going to depend upon the age so i'm going to say if the age is greater than or equal to 18 well if it's true it is going to have assigned the value of true to this variable and after the colon i'm going to define false to this variable and it doesn't have to be true or false this could equally be one and zero or a string or anything else that you'd like it to be all right so there you go conditional statements now let's talk some more about strings now again strings of course are just strings uh or just letters and numbers and spaces and such in between double quotes and i assume that you know that because dart is normally not a first language people learn okay so i'm going to say here i am and you're going to be able to use strings interpolation inside of regular old strings too not just inside of print statements so let's go and get age is equal to and let's throw 45 inside of there you can just go like this put oops put age inside of there like that and that is going to work as well all right so let's go and create another one let's now let's go and print this just so you can see what it looks like all right i am 45 comes in there all right so good stuff what else would we like to do well there's all also multiline strings if you want to create one of those then you can just go s2 is equal to you're just going to put three quotes like that and then you could say something like i am multiline like that and then follow that up with three quotes and write like that so that's how we do multi-line strings and of course you could have the i be up inside of here as well whatever you'd like to do okay what else can we do with strings well we can get the first character in a string so let's say we wanted to get that for s let's do s1 in this situation so s1 and to get the very first one you put a zero inside of there they are zero indexed and that would give you that first character which in this situation will be the letter i you could also find the index where a string you're searching for first falls so we could say s1 dot index of and let's say we're looking for the word am inside of there well there you go that'll get that for you you can concatenate or join strings so we could say create var s3 is equal to and put and i like cats like this and then easily join them together by going s 4 is equal to s1 plus s3 there we go and we could print s4 as well you can check if a string is empty or not so let's go empty like this and string interpolation again and s4 and is empty like that close off your curly brackets and also you're going to be able to find something is not empty and that is we're just going to put this right here not empty and just depends on how you like to look at the world if it's a empty or not empty world all right so there you go and you can see how those both work as well as everything else we've been talking about we're also going to be able to get the length and we can just copy this so i have to keep typing all right print that inside of there and let's change this to length and s4 and just type in length which is going to be very useful and there are numerous different escape characters that you should be aware of and here are the ones that are most common for you new lines tabs how to escape different types of quotes let me give you an example here so it makes more sense so you could say something like print and let's say that you would like to be able to throw new lines and tabs inside of here well you could do something like i and a new line and am like that and a tab and multi-line like that there you go there you are and you can see it prints out i with a new line am and a tab and multi-line alright so that's what i mean by escape characters and anytime you would want to use double quotes inside of a double quoted string of course just precede it with a backslash and you will be able to do that and likewise with everything else you see here there's also the ability to use escape sequences in what are called raw strings so we could come in like this and you just put an r in front of it and what that means is basically new lines characters like this and this are just going to be ignored they're going to be treated like regular old strings and you'll see an example later on in the tutorial where i show how working with raw strings is useful so you could say something like new line like that and like that and in this situation you see that the new r newline character does print when it is a raw string just proceed it with the letter r and there are numerous other different functions here we can work with so let's just copy that throw that right there and so let's say we would like to convert our strings to uppercase and lowercase how can we do that let's just come in here like this and throw some quotes in like that and go s4 and you can just say to upper case and you might say well why would you ever want to convert everything to uppercase or lowercase well very often whenever you're working with strings it's a lot easier to just convert the string that they send you that could have numerous uppercases numerous multi lowercases and make them all lowercase then go and search for whatever you are looking for alright so that is a situation in which changing to uppercase or lowercase makes a lot of sense and if you want to check for lowercase or convert everything to lowercase you just change this to lower case right like that and you can see here their upper case here they're lower case of course there's no such thing as lowercase for numbers now there's numerous different ways that we can check to see if a string is inside of a string so what i'm going to do is i'm going to create a string here and it's just going to be i am here like that and i'm going to close that off get rid of this quote right here and let's say that we want to check to see if it contains the word am well you just come in and say contains and am like that and likewise you're going to also be able to see if a string is going to start with a specific character so let's just so let's just change this to start with like that and we can throw letter i inside of there and we're also going to be able to check if it ends with so we'll just change this to ends with like that and then we'll throw here inside of here and all these are going to come back is true in this situation but of course not true in the real world all right true true true okay all of them are true and you can see why they are true you're also going to be able to get a sub string so let's come in here and i am going to just use s4 in this situation so i'll say s4 like that and we are going to define the index where we want to start searching which is 13 and up to but not including the last index we want to search for like that and you can see if we do that we get l i k and this is with our s4 string which is you can see there's like now if we want to get the full like with the e we just change this to 18 like that run it and you can see that we got the space that was the difference so this is actually should be 14 to 18 and if we do that now we get exactly the word that we are looking for based off of the what we defined with our substring now let's go and let's say you would like to replace part of a string so i'm going to create another one it's going to be called s5 and this is going to be 2 no or not 2 no like that all right and we'll go var and s6 and it's going to be equal to whatever s5 is and we're going to say that we want to replace all and we're going to use what is called a regular expression i'll talk more about those later but this is a very simple way for you to just go regular expression like that and specifically what you would like to search for and then outside of those parentheses what you want to replace the word no with which is the word be and then we can come down here and of course print out s6 and i think you know what it's going to be to be or not to be all right so that's how to replace strings now we're also going to be able to convert strings into an array and in this situation specifically what we want to do is we want to go and take this string and split it now you have to define how you want to define how the words are split i'm going to say that all of the words in the string are going to have spaces between them okay right like that and then you're going to be able to say print as4 like that and you're going to see you converted your string into a list now in a situation in which you would have commas and spaces of course you could come in here and just put a comma and there's already a space and that would work for you as well so you can do anything you'd like as long as you have some definition there let's say that i would like to remove trailing as well as leading white space inside of a string well we're going to be able to do that so let's say i have just a bunch of spaces here i have some words and then i have some more spaces and i'd like to get rid of those so you just use trim there we go there we go and if we run it you can see that it comes back as stuff and got rid of all the white space now one thing to be aware of is if you find yourself making regular changes to a string it's very often better to use what's called a string buffer instead of a string so you don't create numerous different strings and how you create one is let's just call this buff is equal to and string buffer like that all right so we can do something like let's say we're i'm going to talk about four loops here in a minute but they're so easy to figure out you can say something like four and variable defined inside of our for loop and then what we're gonna do is just increment or add one to this value over and over again while i is less than nine and then here is our increment function right like that there you go now you have a preview of the four statements which is coming soon and what we can do is if you want to add values to the string buffer you just say right like that and let's say we just want to keep it simple and we just want to add whatever the current value of i is you can just do that like that and that like that okay and the buffer is not or the string isn't going to be created in this situation until we call to string on it so just two string like that and you could see provided a way for us to just go and add all of those different values onto that or stick them in the string buffer and then print them out and the string buffers have both a write function as you saw right there we can do it again just for the heck of it so we can say right and nine and you're also going to be able to write multiple values so you can say buff and write all there's right all right there and we can go and throw what's called a list which is what we're going to call next just a list of different values so we can throw like a 10 11 and 12 inside of there so that's how you add multiple values and again we can just go and call to string if you want to see all of those printed out there on our screen so there we go and there you can see are all the other additional values that we added and of course you're going to be able to go and get the length of it so let's come in here like this let's get rid of this part right there and we can say something like length and we can go and get the length which is going to be the same as what we did whenever we got the length for our strings and also it's important to know that you're able to use functions like is empty and is not empty to also just like we did with strings along with other different functions that we have here and there you can go and you can see there is the length all right so there you go that is a rundown of strings and string buffers and now we're going to talk about lists now dart has generic containers for data where you can store multiple different values all and then assign them all to exactly the same variable name so we're going to have a variable here and i'm just going to call this l1 like that and what you do here is we're going to find that this list is going to contain strings and this is just an empty one right like that you're also going to be able to go and assign values just by saying list like that and string like this and l2 is equal to and we can go and put multiple values in at the same time exactly like this let's go a like that and like this okay you're also going to be able to create lists with multiple different types this can cause confusion though because these are just considered generic objects and but you can do it you can say one two three and maine like that and pittsburgh for example there you go and there you are now you're going to be able to get indexes for these guys so i am going to say that i want the first or now let's say we want to get to the not whatever is number one index all right which is actually going to be the second in our list we're going to be able to go like this of course dollar sign curly brackets and let's work with l3 in this situation and one and can you guess which one is going to be output onto the screen it is going to be main because it is the second remember this is going to be zero all right let's do more let's say we would like to make a list and this is l4 and we want to define that we want three spaces inside of it and we want everything to have a value of zero and we want to define that this list can be increased in size all right well we can do that just by saying list and it's going to contain integers and you can say filled and three spaces zero in every one of those spaces and grow a bowl and set this for true and it will be able to be increased in size now you can come in and also add values so let's say we want to add c to our list of grades this guy up here we're also going to be able to add multiple different values by saying add all like this and let's say let's put a d inside of here and an f inside of here and there we are and we're going to be able to get length again i'm sure you can probably guess how we're going to get the length you just say length like that and like this and we can go l2 and length and curly brackets and that's going to get the length for our list we can also come in and check if a list contains a specific value so let's go and copy this guy right here and paste it inside of there and let's just type in main and let's say we want to find out if the list contains main let's change this to l3 and let's change this to contains like that and main and remember your quotes and that is going to tell us if main exists in that list or not you're also going to be able to sort list just by calling sort and what this is going to do is it's going to say take the first item in the list and compare it to the next item in the list like that a dot compare two b and it's going to compare each value one after another until they have all been sorted and also we're going to be able to print these lists i showed you before how to do it you can say variable value that value is going to be the temporary holding cell for the list that we are cycling through which is list l2 and what we want to do here is we want to cycle through each of those items assign the value to the variable name val and then we want to print out all of those values and we can do that like that and here you can see the output for everything and you can also see that everything has been sorted for us because we told it we wanted it sorted we're going to also let's say we would like to find the index for the letter f well i can call this f index is equal to l and 2. just call index of and we're specifically looking for f now we can use that information to specifically remove that index by going remove like that and remove at specifically and it's going to be the index where f was found and then we can also of course clear our list which means delete all of the data inside of them all right and if we run that you can see well nothing changed because we just removed values and cleared them so of course nothing's going to change another thing that is very useful is let's say we would like to generate a lan random list of values something i do a lot well let's just go and create a random function here and or a random variable and just go random like this and there you go and we can say that we want to create list five so this is going to be list and it's going to have integers inside of it and then we can go and call generate and five and uh int and this will be index like this and then put this little arrow symbol and call r2 and next int like that and let's get random values up to 100 like that and there we go and then we will be able to come in here once again and cycle through and print out these random values so we're going to create five random values that are going to be integers all right so we want to print them out again val in l5 like this and print and call that we want the value to be printed and we can run this and every single time we do we're going to get five new random values another thing is we're going to be able to get the first as well as the last value so throw this inside of here like this and l five and we can get first like this and of course i'm guessing you can probably guess how we're gonna get the last one yes indeed you are probably correct if you said change this to the word last and there you are and there you go all right good stuff we can also create what is called a iterable with a range of different values so iterable like this and int like that let's call this i 1 and we can go and get l 5 and get range like that so let's say we want to cycle through the zero through the second index we can do so and let's just go and copy this right here and paste it down inside of here and then we'll just change this into i 1 and everything else here is exactly the same and there we go and you can see that we printed out 58 and 25 and then finally i'll show you how to convert a list into a string so let's go and create a string s7 which is we're going to call the list l5 and we're going to say that we want to join these items and we want to put a space between all of them in our new string and then we can go and print out our new string exactly like that and there they are all right so there you go example of strings and i've been talking about looping so now i'm going to cover it fully all right got some coffee let's talk about looping all right so we already talked about for loops but let me review it so you define a variable there you are like that just like we do outside of a looping structure and as long as i is less than let's go and create ourselves a list there you go throw this in here just generate this list just like we did previously and let's go and do random r2 dot equal to new random like that and there we are okay so we can say wow i is less than the length of this list we want to continue looping okay and of course we have to increment the value of i each way through and then we can come in and we can print all of the individual indexes inside of this list all right exactly like we talked about previously and there are our random values now you're also going to have four each and you're mainly going to use four each anytime you don't care about the index so if you don't care about the index well who cares let's just cycle through it so we're going to use for each much easier to use define our value that we want to assign to each individual part of the list as they come out of the list and go like this and like this and boom there you go and you're going to be able to also cycle through and print all of your list items that way also you're going to be able to perform different calculations so let's go and do well let's just use our for each we have here so as we cycle through each of these let's say we want to multiply these values times say 20. you can do that perform any other calculations and you can see there is the results there as well and if you're wondering why you didn't see the results previously it was because it was the same list printed twice here let me actually go back and show it to you so it doesn't cause any confusion so let's save it and see the two here that just means that this was printed two times all right so just didn't want you to get confused there if you saw that and were wondering what was going on let's also come in and let's create a string and it's gonna have some words on it so bob and sue and tom right like that and let's say we want to split this and print each word in a string we can say for var and person in str1 and call split and we want to use the space specifically to define where each individual piece is going to be found and then we can just come in here and go person like that and go and execute it and another way to cycle through here and print out this information now a while loop is going to work slightly different you're mainly going to use while loops whenever you don't know how many times you want to execute code so i'm going to create a variable here and i'll call it i2 and give it a value of 1. and what i want to do in this situation is i want to define that i want to continue executing code as long as i2 is less than 10 but then what i want to do is i want to say that i want to print only odd numbers and on top of that i want to stop at the number 7. so how would i do that well i'm going to say if i to modulus 2 is equal to 0 well in this situation we know that if the remainder of a division with 2 is 0 that means it's an even value so i'm going to say well i don't want to print that instead i want to increment the value for i2 and then i want to jump back up here and continue now with a new version or a new value inside of i2 how do i do that i just say continue jumps back up to the top of the loop and continues executing except now let's say i2 starts off with a value of one well actually it wouldn't work that way it would be a value of two then it would come down here it would now be have a value of three it would jump back up here and continue checking all right so that's what continue does for you now i also said i want to print if i2 is equal to an odd value but i also said i want to jump completely out of the looping anytime i two equals seven so i'm just going to put in another conditional and say break now if we get down here we know that it is an odd number and on top of that it's not 7. so we can print it but don't forget to increment the value of i2 and we will do that right like this and if we save this and run it you're gonna see that it went and printed one three and five exactly like we wanted it to do all right what else can we do well there's also a do while loop and you're going to use those anytime you want to guarantee you execute at least once through your code and what i'm going to do is i'm going to come up here and use our random object that we have up inside of here and i'm going to create a lucky number and then create the simulation of a guessing game so i'm going to say that lucky is going to be equal to r2 and next int and 10 right like this and i'm going to make this var lucky so there is our random value that we're going to try to guess and i'm going to start off guessing at negative 1 and let's spell guess correctly there we go and then i'm going to do my do while loop so i'm going to say do i go like this and i'm going to go and get the value for guess and increment it and then i'm going to say print and just so we can track what's going on the guess in this situation is going to slowly increment up yes i know i can get this result a lot quicker by jumping into the center of the list but i'm just doing this to demonstrate the do while loop all right and that's it and then what we do afterwards is we put our condition down here that we're going to check after we have executed it once so we're going to say we want to continue looping as long as lucky is not equal to the value of guess and then also what we know is if we get through this do while loop well that means we found it so we can just jump down here like this and print and say lucky is like this lucky is and then put in the value of lucky meaning that we were able to find it and if we execute you're going to see that it guessed the whole way up to eight found out that lucky was eight and we can continue executing that time it was zero and this time it was five and there you go there's multiple different ways to loop and now i want to talk about map collections all right so basically a map is just going to be a collection of key value pairs so as you're going to see i'm gonna do superheroes i'm gonna have the key be superman and the value associated with that key be clark kent okay and they can grow as well as shrink how you declare an empty map is you need to define what types of data are going to be inside of them so i can say that i want a string for my key and an integer for my value equal to new map and then you have to put in the same thing string and int exactly like that and there you go you just created an empty map so let's go and declare one and initialize it we can also go and let's say we want to go heroes heroes like this is equal to and inside of curly brackets we're going to define our key which is going to be superman follow that up with a colon and then put in clark kent there you go and sorry superman gave away your secret identity then you can have batman key and a key is just like an index with lists and bruce wayne right like that there you go you created a map now what else can we do well we can add another hero in here if we would like to so we'll say heroes and flash is the key and it is going to contain a value of barry allen so there that is what else can we do well we can check to see if our map is empty or not just by coming in here like this and going inside of curly brackets heroes is empty and of course we can do is not empty just like we did previously you can go and play around with things like this there we are curly brackets and test out the other functions like is not empty uh we can get our length might as well just copy this paste it inside of there to save some time paste that there and put length inside of here there is length and if we want to get the hero's length guess what we just type in length there it is what else can we do well we can print our keys and i'm going to use for each to do that so we have heroes and i'm going to say keys is what i want to print and for each and we can do value inside of here like that and a little arrow and go and print that value out there we go we can also print out just the values so come down here change this to values like that and guess what that's going to work and we can run all this whoops i have an error what'd i do oh i spelled values wrong there you go and if you ever get this just come up here and go to debug console and there you go and you can see we printed out the keys and the values associated with those keys what else can we do well let's say that we would like to add multiple different values so let's say that uh some villains decided to come in and join the heroes for something so i'll say heroes add all and like this and we'll say lex luthor became a hero and what's his i know that's lex luthor not very creative is it and we can come in also and get loki and uh loki's secret identity is there all right and that will add both of those as well well then maybe we find out that lex luthor wasn't being honest after all so we're gonna say hey we want to remove lex luthor from the hero list he's a bad guy and there that's taken out and what else we can also come in and do heroes and clear to get rid of everything and we can come up here where's the empty thing at there it is we can go and copy this just to verify that everything has been deleted save boom boom and there you can see yes indeed it is empty all right and that is the basics of what you need to know about maps and now i want to talk about enumerated types all right so enumerated types contain lists of constants with an index and you're going to have to define it outside of main and you just type in enum like that and day and then let's just go and define some days of the week so there those are and there's thursday and there's friday there you go you just defined it and we don't put a semicolon at the end there now down inside of main i'll leave that on there so you can see it because we have plenty of room i can come in on here inside of main now and define my favorite day and that day would be equal to friday so there we are and this is an uppercase make sure everything's uh case sensitive inside of dart now i can come in and say print and value and favorite day like that semicolon at the end and i can go and also print out the index and like this and favorite day dot index and there we are like that and the one thing that's cool about enumerated types whoops got an error what was my error oh i accidentally got rid of this last curly bracket just say cancel throw that there curly bracket there we are now it's fine run it and there you can see how it printed that out and what's really cool about enumerated types is by using enumerated types we can guarantee that we will only receive one of the specified options for example sent to our functions and that's just going to eliminate very often the need to use if statements and other conditionals which is extremely useful all right and so there's a numerator types now let's talk about ruins all right so basically a ruin is an integer that represents a unicode for and unicode represents all letters numbers symbols and everything so you can see here an example of that and here is wikipedia if you just type in list of unicode characters like that inside of wikipedia you will see these and this is unicodes and this specific number right here is going to be what we're going to be dealing with alright so all of the unicode symbols so actually there's a whole bunch more all right so there you go and basically a ruin is just that integer value that represents all the characters so what we can do here is let's assign and print a unicode to start off so i'm gonna go number one is equal to and backslash this is unicode zero zero three one right like that and i just showed you where to get the unicode list so there you got that and now if i come in and print number one like that and run it you can see it prints out the number one whenever i provide that unicode for number one you can also get the unicode so let's say i'm going to go and create a string here let's call this uc1 is equal to strange like that and let's say i would like to get to the unicode of a specific letter how can i do that well i'm going to print this out and i'm going to say that i want the unicode for the letter t in strange so got that right there and how i specifically target it is i just provide the variable name and then i say code unit at and i want the second one and this is zero index so that means that's going to be one right like that and there we go so that's how we can get the unicode for t we can get all the unicodes for all of these so we can go uc one like this and i will say code units like that and if we run this you're gonna see there's all of them inside of a list and you can see 116 matches up with the t that's right there and we're also going to be able to iterate through these and you can just go ruins 4 each and int r 1 and like this and then just go variable c1 is equal to new string from character code r1 and then print out c1 like that and then throw a semicolon at the end here and if we run it you can see that there we went and got all of them all right so quick run down just to some examples of runes and how they can be used and now i want to talk about functions all right so you're going to define your functions outside of main once again i'm going to create a basic function it's going to return an integer it's going to be called git sum it is going to receive two parameters i'm going to call them n1 and n2 you don't need to find the type and then it's going to take those two values add them and return them all right and that's how git sum is going to work let's go and make a couple other different git sumps all right so let's go and create git sum and let's just call this git sum2 you're also going to be able to come in here and define default values so let's go and get into and let's say that we would like it to have a default value oops accidentally deleted it of zero there you go now it has a default value of zero let's say also that we'd like to dramatically simplify this function we can also do that so we could also go get sum and let's call this three it also receives n1 and n2 and we can just use this arrow function right here to just go n1 plus n2 and you're going to see that all three of these are going to work in pretty much the same way all right so let's create some functions here i'm going to create some functions that just basically do the same type of thing and that is add values i'm going to i'm going to create a bunch of functions that do other things all right so this returns an integer that's what that means it's named git sum and n1n2 like this and what it does is it receives the parameter n1 and m2 they're going to have values it's going to take both of them and it's going to add both of them and return it and this return value is going to be an integer all right let's create another type of get sum though so let's go down here paste that in there and let's just call this git sum2 we're also going to be able to come in here and give parameters default values just like that and that in it there it is default value another thing that's cool is there is a simplified way using the arrow function of doing exactly the same thing let's call this git sum three again receives two different parameters inside of here and it is going to return them n1 plus n2 and there you go sometimes you won't be able to do this because you it's complicated but other than that everything else is going to work perfectly now let's come down inside of main and i will call these functions so i'm going to say print and i'll just say 5 plus 4 is equal to and go and call the first get sum and pass it values of 5 and 4 right like that throw a semicolon on the end and there you go and of course you're going to be able to do the same with get sum to but also you'll have the added benefit that if you don't provide a value it's still going to work so let's just leave this as five and you'll see that it also works and throw this inside of here another thing you can do is come in and override that default value just by going n2 like this and throw four inside of it as well and of course make this and get some too there we are and get some 3 is going to work in exactly the same way but let's throw it in here and test it just to verify so there's good sum three there we are run them and all of them are going to give you the results that you were expecting but maybe you would like to be able to receive a list of values passed inside here how do you do that well i'm going to go and create another one i'll call this git sum four and it's going to receive a list there you go just like that and now you can pass as many values in as you could possibly want and it's automatically going to work so all we need to do here is go return vals and there's an awesome function called reduce and it's going to take each value as it cycles through putting their value inside of a and b and you can cycle through them and add them there you go like that and there you go so there that is how to receive a list of values what else would you like to do maybe you'd like to return multiple values well it's going to return a list so let's say we want to get past the value and pass the next two numbers so if you get a 1 it's going to return a 2 and a 3. well receives a value and like this then you just simply create a list and return said list plus one like that and n one plus two like that and both of those are going to work all right so if we come down inside of here we can grab this and copy it and test out these new functions so i'm going to say that i want to get the sum this time of multiple different values i'm going to use git sum 4 and i'm going to pass a list of values inside of it so like this now it's a list one two and three and it's automatically going to work what else can we do well i'm gonna be able to receive a list one way to do that i'm gonna call next2 and i'm going to pass 4 to our function we created and then i'm going to call for each take all the values that were passed back and then i am going to cycle through and print all of the values that were passed back so like this and like this there's an extra parenthesis that slipped in there somehow and one that was missing back here there we go and don't forget to your little arrow function inside of there and if we go and we run that you're going to see that those worked as well all right so pretty cool stuff all right so now i'm going to show you how to make a function that returns a custom function so what we're going to do is we are going to say function and i am going to call this malt by what it's going to do is it is going to receive a value and let's just call this n1 and it is going to create a custom function oh by the way might as well do something else let's create an inner function so this isn't a function inside of another function so here that is and it has a value and what it's going to do is return that value times the value that was passed in right here all right so pretty cool stuff and then we can just say return enter function like that but we don't want this part on here like that all right so what it's going to do is it's going to create a custom multiplying function n one is going to represent what this function that we're creating is going to multiply the value x passed into it by so probably better just to look at it running and it'll totally make sense so let's come down inside of here and i'm going to say print like this and 3 which is the number i want my custom function to multiply values times and the value i'm going to multiply it by is 5. so got this right here and then i'm going to go and call it so mult by like that pass the 3 which is what it's going to multiply times and a5 which is what it's going to multiply three times all right so right like that and if we run it you could see it gets the 3 multiplies the times the 5 and gives us 15. so cool stuff now we've talked about anonymous functions previously but let's make another one all right so this anonymous function is going to tell us if a number is even or not it's going to return a boolean and function and you just type in int see it doesn't have a name function is what's inside of there so it receives an integer and is even like that is equal to and int x and what it's going to do now with that x that is passed inside of it or that parameter named x is it's going to use the modulus symbol 2 and see if it is 0 and return true or false based off of the result and the cool thing is is you can go and create these anonymous functions down inside of main so let's just jump down here and do that so right like this there we are anonymous function and we can just go in and do something like print and say 202 is it even or not i think you know the answer to that but why not we just do just do it this way so we'll call is even and 202 like that like this close that off and like that whoops it's is even like that run it and you can see it comes back as true and let's do one more function here let's also do what is called a recursive function which is a function that calls itself so we are going to come in here and calculate fibonacci numbers so i'm just going to call this fib it receives an integer i'm going to call it n1 and it's going to say if the value of n1 is less than or equal to 1. well in that situation we will return a value of 1. you always need a situation or a condition that is not going to call the function for a recursive function to work all right and else in other situations we are going to call the the fib function and we're just going to pass in a decrementing value of n1 plus and again fibonacci i'll explain how this works here to be precise and -2 exactly like that and exactly like that except make this fib there you go and and the way this is going to work this is a recursive function is let's say we pass 4 inside of it well as you can see down here we're then going to be calling it using three as well as down here with a two all right and of course the whenever it receives a three it's going to convert that to two and one and then fib two is going to add one plus one because that's what fib one is give us a final result of two this two right here is going to jump right there the 1 of course is going to jump right there because this returns a1 then this is going to be 3 that 3 goes here then we add 2 to it from this down here and that is how we get our final value using a recursive function so let's come down here and let's execute it so we can just come down and we could say print and fib 4 like that and then come in and call our recursive function pass in the value all four close that off right like that run it and you can see that we get a value of five and that's how recursive functions work as well as calculating fibonacci numbers and this brings us to type definitions so let's get rid of all of that other information right there and basically what makes a type definition cool is it is used to reference a function by defining a signature basically the way the function's going to work with specific parameters and we want functions to match and what you could do is assign them to a specific type definition type all right and you're going to be able to change its value and like always it's probably better just to see an example to see exactly what's going on so what we want to do is we want to define a type definition and how you do that you go type definition and we're going to call this do math and what we're going to say we're looking for is a function that receives two integers n1 and n2 like that and nothing is going to be returned and what's good about this is it can be pointed at any function that receives two integers and another thing that's cool is type definition can also be passed as a parameter to functions as well so let's go and create two different functions here so i'm going to create add and it's going to receive an integer and another integer right like this and it's going to simply print out the value of n like this plus and the value of n2 and then inside of here it's going to add both of those together right like that and print it out on the screen now we can do the same thing with a subtraction function just for simplicity sakes let's make this called sub and then let's just change this to negative and change this to negative all right so now let's look at the power this provides us we can now down inside of main go do math like this and let's call this math function and we can say that it's equal to add in this same situation and now we can change the functionality of this function on the fly right like this all right just that simple before we execute it let's do another one let's just go and point at the other function now equal to and this is going to subtract and we'll do exactly the same call and it's going to call totally different functions which is neat and there you go that is how you get your different values and of course it looks a little bit nicer if we throw equal signs inside of here so let's do that and let's run it and there you are okay so there's an example using type definitions and whenever i get into flutter i'll provide even more real world situations in which you can use this to benefit yourself but moving right along let's talk about classes as well as objects and inheritance and all that so a class like you're probably aware is just a blueprint for creating objects so let's say i want to model a shape what we must ask ourselves is what does a shape have well a shape is going to have a height give it a value of 0 by default what else is a shape probably going to have well it's probably gonna have a width let's give that another value maybe it also has a unit because what is a measurement if it doesn't have a unit kind of worthless isn't it now so let's say this is centimeters okay that's what it is by default what else can we do well let's get the space out of here we can also define a value that belongs to the class so what would be a situation in which we'd want to do that well let's say every single time we make a shape we want to monitor that shape so if we make 10 shapes we want to be able to call this and know that it's 10. this being static means that this variable right here whenever the value changes for one object of type shape it's going to change for all of them it is going to be the same always all right so we're going to put that inside of there as well one thing we're going to need to do is we're going to need to set up our shapes whenever we create them to do that we use something called a constructor and you can recognize them because they have the exact same name as your class and you're going to have a default constructor which in this situation is just going to keep things as default values this is a way for us to refer to the object that we don't have a name for because we create the class before we create the object we don't know what the object's name is an easy way to refer to an object is to use the word this all right and we'll have this height and we'll have this width and define all of these values and what else do we want well we want to monitor the shapes we just created a new shape so we want to monitor that well how do we go and set the value this is static and it belongs to the class we refer to the class name followed with number of shapes and increment it there we are we created an object all right what else do we want to do well there are situations in which we would like to set the value for shapes whenever we create them and to do that in dart you use something a little bit different and what it is called is a named constructor so let's say i only receive one value and i'm just gonna go and copy this so copy that paste this inside of here right like that we can't just use shape and a different number of parameters that doesn't work you can come in and say we receive a length well what we need to do is this is called a named constructor and you're going to specifically call the from length version of this right here and in this situation both the height and the width are going to be equal to whatever the length is everything else exactly the same let's create another named constructor and this one is going to receive a height and width so in this situation we'll change this from length to width and height like that and we'll say that we get a double inside of here which is the height and another double inside of here which is the width there we are and then what we can do is go and get the height paste it inside of here and we can get the width and let's just go with like that everything else exactly the same another thing we have inside of classes is getters and they are used to return data in a descriptive way let's say like for example we said width and height don't matter if we don't know what the unit is centimeters like that so our getters and our getter is going to provide it's going to tack on the centimeters and maybe we changed the unit for this and that's how we can go and get more detailed information so we can protect the data but also provide the information in new ways so we're going to say shape height in this situation is a getter it's defined as a getter because we have get right there and we're going to say return the height and to string oops to string like this like that and then we're going to add on a space inside of here and then tack on the units afterwards so that is a awesome way of providing additional information and here's another one and this is going to be the shape width like that and we'll just change this to width and everything else is exactly the same now if we have a getter to make sure we get custom information in regards to our data there's another thing that is called a setter and what we want to do with this is we want to use it to protect our data so one thing we might want to do is check if a string is a number well let's create a custom function that does that and it's going to be static why is that well shape the concept of is a shape a number doesn't really make any sense sort of sounds like a utility function very much like the number of shapes was a utility thing and in that situation anytime you have something that doesn't directly apply to an object probably means it should be static so i'm going to say is number and string s so it's going to get a string and tell you if it's a number or not let's go and close that up right there and how do we do this well it's very simple we just say return and double and try parse like this and as i said before try parse and if it doesn't work we get a value of null assigned when we use tri-parse versus parse and then all we have to do is go and check to see if this is null so let's create our setter which is what we were going to do before so we'll say void set a value for shape height and it is going to receive a string which is going to be represented with the letter h i'm going to say if is number like that pass in the h right like that and if it is a number well we're going to say that's cool we can assign it so a setter is here to protect our data and we can say double parse whoops parse h to convert it into a double and we know that's going to work and we can also protect our our width in pretty much exactly the same way so let's just change this the width whoops width like that is number and it's going to get w and this is going to be w and this is going to be width like that and this is going to be w there you go getters and sutters what else would we like to do well we would maybe want to get the area for our shape so we're going to say double area and how do we do this well we stay here on this line first and then we are just going to simply multiply them together so i'm going to say width times height and that is the area of our shape and there you go now we can come down inside of main and test this out so let's create a shape let's call it sq1 equal to and this is how we create a shape with a just default constructor right like that and we'll go and create other different shapes let's call this uh sq2 and what we're going to do here is we're going to use the named constructor from length so from length right like this and maybe we'll put a value of 3.0 inside of there and then we will use the other name constructor to create another different shape and again this is going to be from and what did i even call it that i call it wh from wh let's just copy this all right from wh come down inside of here from wh like that and then maybe we will throw inside of here 3.0 and 4.0 right like that so there we went and created multiple different shapes and we can come in and say print square 3 area like that and call and get it sq3 and area and it's going to be able to come in and calculate that and i'll put it on our screen so interesting stuff and if we go and run it you're going to see it gets the area all right that brings us to the concept of what is called inheritance now let's say we want to create a new thing that is almost exactly like a shape but it's a circle all right well circle areas aren't calculated by width and height so how do we go in make a thing that's going to get all of these awesome functions and constructors and all this awesome stuff but at the same time work as a circle well we use something called inheritance and we will inherit every single function every single variable from the shape class how you do that you just say class and circle and extends shape so we're going to get all that stuff and then if you want to override the area function because it doesn't work with a circle you can do that all you need to do is go over ride like that and define your own custom area right like that whoops override accidentally hit the wrong thing here so get rid of this over right right like that okay there we go and this custom circle area right like this is going to say if this width see we're going to have access to all of those variables so in a situation in which width is equal to 0 we're going to return pi which is a constant times the power of this width divided by 2 and to the power of 2. okay so there's that and else and this is very very similar so i'm going to copy this i'm going to say else if and in this situation height like that is not equal to zero well then we're going to multiply we're going to use height instead so right like that and then otherwise else like this we are going to return zero so return zero and there you go there is our custom area function now one thing that would be beneficial is for us to go and execute our all of the functions that are inside of the shape class how do we do that well one thing we can do is let's say we wanted to actually use the shape version of area we can do it well yes let's just put it like this you would just call inside of your functions inside of your class you could just say super like this and area and it would go and execute the super version of area or the shape version of area okay another thing that is very useful is to be able to use the superclass constructors to set everything also very easy so rather than type all those out we can just say circle like this and call the superversion right like that and we can also go circle and from length with our named constructor and it receives a w i'm going to give it a value of l and let's call the superversion of from length like this and pass in l and it will just handle it for us and we have one more here if we have the width and the height and again w is going to be h and w or double is going to be double here and again call the superversion and from wh and pass in the width and the height and there you go that calls the shape version of our constructor and gets all the benefits there as well so really awesome now we can come down inside of here and we can define a circle so i'm going to say circle and i'm just going to call it circ is equal to new and circle from length like that pass in 4 there we are and then we can come in and say print circle area like that and go and call our new circle area function like this and like that you can play around with the other functions that i have inside of there like the number of shapes and things like that on your own whoops what's this don't know why that popped in there let's just get rid of it okay so there it is let's go and let's run it and there you can see we were able to get our areas circle so pretty neat stuff right there and that brings us to the concept of interfaces all right so basically you can only ever extend one class however you can go and implement multiple different interfaces and what an interface is it's basically like a contract and what it says is that if you implement it you must implement all defined functions in the interface so let's create one and it's just a class just like anything else so let's say we're trying to model some type of printer that is going to be able to print a laser print as well as let's go laser like that this is a function that must be implemented if you implement the print laser class and also let's go down here and let's say it also print the prints to an inkjet so we can go inkjet and come down here and just change this to inkjet as well there you go well now what we can do is we can define a basic print function that is going to implement both of these capabilities so implement both print laser as well as print inkjet and print and inkjet inkjet all right so there they are and then of course what you need to do is go in and implement those functions so i'll just say void and it doesn't matter what you do in this situation just keeping it rather simple whenever i get into flutter i'll get more into interfaces but for now i think this is enough to understand the basic concepts of what is going on here and then we'll just call this inkjet exactly the same say print enchant a print print inkjet and print laser right like that and there we are basic concept of interfaces which i'll get more into if this video gets views and whenever i cover flutter another collection type that we have available to us is what is called a set and a set is just a collection of objects however they must all be unique so it's just like a similar to a list like we covered before and kind of similar to a map kind of except maps if you remember our key value pairs and basically this is how you create a set and you want to add a value to it that's how you add a value to the set and you can go and add another value to it let's say that we want to add 13 for some reason you're also going to be able to add multiple different values at once so let's create another set like this equal to new and set like that from and just throw a list inside and it's cool with that it can work like that and there you are and you're going to be able to cycle and you're also going to be able to clear the set using exactly the same functions as we have used with other collections so there's that and if we want to cycle just so you can see what it looks like whenever we run this there you go and there you go and there's a set all right so sets just wanted to cover them just to cover more of the dark programming language and now to finish up this rather large tutorial i want to talk about exception handling so what we're going to do here is basically exception handling provides a way for you to catch errors and handle them gracefully so that they don't completely crash your entire program so i'm gonna use an example here of trying to divide by zero how you uh define them is any problematic code you're gonna put inside of what's called a tri block try two curly braces you put your potential error causing code inside of here so i'm gonna say print like this and i'm gonna say zero divide like that and then inside of here i can go and get enum and try to divide it by zero this is going to cause an error which we are going to catch the closing bracket right there and then down here we will say catch and the error is going to be passed inside of here we can print the error rather than have the program completely crash and look terrible and let's say also that we always want to do a certain thing whenever our program crashes like this for example you might be working with a database and you want to close the database or something like that well if there's code that always executes you put it inside of finally and guess what it'll execute okay so now if we run this all right this zero divide infinity right like that and then you also see i always execute which comes from right here so this is the name of the error that you tried to divide by zero and you got an infinite value and that is an error that's a bad thing but we handled it gracefully gave them sort of a message rather than our program completely crashing well you can also come in here and you can go and create your own exceptions so what i want to do is come up inside or outside of main and this guy is not going to return anything and it is going to check age so let's say we wanted to verify that a name or an age was valid well we could pass it inside of here and we could say a if a is less than one we're going to say that it's not a valid age and in this situation we want to throw an exception and a good way to do this is to use this default format exception and then what we can do is come down inside of here and go and test it so we're going to say try like this and we're going to say that we want to define an age which is going to be equal to zero well that's not valid and we're gonna crash our own program here on purpose i'm gonna call check age like that a1 like that and then come down here catch and we are going to catch the exception that's going to be passed guess what the exception is format exception we just threw it all right and this is going to print it out print out that exception like this like that like this and there you go and run it and you can see format exception comes out one thing to finally be aware of is instead of catch e like this you could also go and type in on and look for a specific exception so one of them is integer division by zero exception okay so instead of catch e you could type on integer division by zero exception be very very specific and also you could end that with catch and e and also output that exception on the screen if you'd like all right so there you go guys a pretty thorough overview of dart and depending upon how popular this video is that's going to determine how many videos i devote to teaching you how to program with flutter and like always please leave your questions and comments down below otherwise till next time
Info
Channel: Derek Banas
Views: 17,072
Rating: undefined out of 5
Keywords:
Id: veMhOYRib9o
Channel Id: undefined
Length: 97min 57sec (5877 seconds)
Published: Sun Jul 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.