 Hey everybody, it's Brian and welcome to the 16th Flutter Tutorial. We're still on the Dart learning curve here We've covered quite a bit, but what we need to do now is we scroll all the way down here You see there's libraries and visibility and I wanted to talk about this a little bit here In Dart everything is a library including the programs that we've made up to this point There's a distinction in how those libraries are actually Set up and how they're used though another distinction is Whether they're internal to Dart they start with the import Dart semicolon or whether they are packages that are not included in Dart itself There is a lot out there and to be brutally honest. There's some of these features you may never actually use You can import a package as a variable You can actually show only specific parts of a package and hide specific parts of a package You can even do lazy loading of a library meaning you can have this massive library and only load the pieces You need as you need them. It's actually a really cool feature They don't really cover it a lot in the tour of Dart You have to actually click on libraries over here and you can see there's a tour of the Dart libraries Commonly use libraries and then a whole tutorial on how to create your own library packages We're gonna cover a little bit of this But I wanted you to be aware of this for future tutorials here that when you click on that Let me back up in case that wasn't apparent when I did you click on tour of Dart libraries and You can see they have got just a ton of information of All of the built-in functionality with Dart and their slogan is batteries included Which I think they kind of took that plagiarize that from Python. I'm not sure which one came first I'm pretty sure it was Python But anyways, it is actually batteries included. There's a lot of bang for your buck in here One of my favorites is they have you know browser based apps They have I owe they have conversion and they have mirroring which is reflection So it's really nice to have this right into the library itself. So you don't have to go and get something external however Back here you should be aware that you can actually make your own and you can publish it out on this thing called pub Dot dart Lang org now if you're wondering what it's pub pub is a tool for managing Dart packages And if you go out to pub art playing org, you can see there is a lot out here So let's say we want to and I'm just going to pick something at random Image you can see there's image pictures flutter image zoomable image image carousels image transformers Okay, let's try something a little more specific like resize All right, so here's a good one provides a server and web apps with the ability to load manipulate save images Various image file formats and you can see it works in flutter it works on server and it works on web So we actually just click on this and it gives you a brief rundown and not all of these are created equally mind you but Some of them have a lot of documentation. Some of them don't You can see the author. This was not an official dart package And you can see that it has no reliant reliance on Dart IO So it can be used on both server and web applications You can read write all of these formats read only those and it has all of these functions built in and It has a change log and how to install and how to use which we'll cover in a future tutorial But for this tutorial specifically I wanted you to know that that functionality exists Just know that there is a massive amount and it's a growing daily of Libraries out there for you to use and just about any functionality you can think of is already out there And it's I mean as you're listening to me speak it is continuing to grow and grow and grow I've heard a lot of programmers say oh dart is dead. Don't work with dart I've actually seen it grow right before my own eyes and it's kind of crazy So let's dive into This one We're gonna make our console amp We'll call this lib intro Why I don't know just because I couldn't come up with a better name All right, so Now that we have got this Little bit of explaining what's going on here You can see how we have this folder live and we have this folder pub When we use something Out on the public i.e in pub dart It actually goes in here and you'll see that in future tutorials What we're going to be working with is right here and in the built-in libraries So let's actually Expand this and this is just boilerplate. This comes with every single application that we've made to date And you can see how it says import package semicolon and then it has the path lib intro slash lib intro dot dart as because we're importing this as a variable And then we can down here lib intro dot calc And we can import this as pretty much anything we want. I mean we could say cat And then it will calculate Using the function out here and we've talked about this before how we can add things in It's a pretty strong feature to be able to do that You can structure this pretty much any way you want There are some caveats One thing you'll have to have and we'll cover this when we actually build our own library is you'll have to have this pub spec yaml Which just has some details into it. All right, so What I wanted to cover is the differences here. So let's actually work with a built-in Uh Dart package here. So let's say local Notice how I'm starting with dart semicolon and you can see all of these that have come built in That's pretty crazy, right? We've worked with a sync before So that's what we're going to work with is called convert convert Really has some pretty nice features to it But what we're going to work with a little bit is called json. If you don't know what that is. It's a way of Stringify, I guess is a good way of putting it an object so that you can work with it Some people like xml some people like json It basically takes an object and makes it into a giant string or variable That you can pump off to the network read it into another program and convert it back into an object So we're going to make a map I'm going to say string it And then we're going to say map Put if absent And what we're going to do here is we're just going to say put my agent here And now I feel old. I feel ancient I play call of duty and these kids like mop the map with my face And we'll just throw my daughter in there So what we're going to do now is we're going to actually Um convert that object into a string. So I'm going to say string encode and we're going to encode the map itself And we're just going to print this out and you can see there is the json Right there. That's the string representation of that object So now we want to convert this well from a string back into an object So we're going to say map string int And let's call this people so we know that we have a different object all together And we're going to take that string And decode that into an object And we're just going to say people For each and then we have our Key value pair Maybe that was kind of bad We have our key value pair And we're just going to print that out So really all we're doing is we're taking our map our object Using json to encode it into a string and then using json to take that string and Decode it back into an object And you can see Here's our json And here's our actual decoded object being printed out in the for each So this seems like a very simple example, but it really shows you just how powerful Dart is Not so much that it can do json encoding and decoding other languages can do that obviously But the fact that you can very easily add this functionality right into your application without jumping through a lot of hoops Like you have to with other languages Sometimes you'll have to Import this do some local build do some extra steps do some configuration dot it on most of the time It's a very simple very easy Um, and I think in future tutorials probably actually maybe the next tutorial. We're going to actually show how to Just grab something random off of pub dartlang.org and show you how to leverage somebody else's code I may have to actually well, I mean it's not that I may I'm going to definitely have to test a few of these That make sure they actually work as intended um But I mean as you can see just about anything you can really think of like let's just say Let's say you want to do a server. Let's look out here Okay, so there's all different types of tcp servers a web server. Here's a multi server web server middleware icu server Um, let's just pick something completely random here. Let's say irc There's an irc library out here irc client. I mean As you can see there's just a lot out here and it's I hate to sound like a broken record, but it's continually growing So it's very important that you learn how to work with this because a lot of the times You'll find functionality that you need already exists and rather than reinventing the wheel You're going to have to import the code and actually work with it That's all for this tutorial. I hope you found this educational entertaining Once again visit my website void realms.com Click on tutorials and then github for the source code for this and all other tutorials And this is 100 funded by your donation So if you found this remotely helpful and you're not a college and you're not a starving college student Go ahead and donate a few dollars if you will Every dollar that you send funds this website and at the end of the year if it's I have what's called an overage meaning I have more money than what I need to fund the website It goes into a charity And last but not least Be sure to go to the contact page and visit the void realms facebook group There's 1700 other programmers out there that can help you