Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 1.13 KB

11. Using Private Properties.md

File metadata and controls

13 lines (7 loc) · 1.13 KB

-- Stateful widget can manage internal Data.

--> Private Properties.

-- in Dart you variables(properties) in classes and methods(functions).

-- now in dart you can also put ur code in more than one file. we only used one file thus far. but we also imported material.dart file too.

-- now as default, every file is its own enclosed ecosystem, every file in lib folder(main library) has its own mini library, these files can still work together with the help of import statement. but you can control what can be accessed and imported in another file. because we might want to have for example only thing that should use MyAppState class is the MyApp class.

-- suppose we are working with other developers and want put restrication on MyAppState class that it cant be used or manipulated outside of this file.

-- so to tell dart that this class can be used inside of its own file and not from outside of this file u can add _ before the classname like _MyAppState. this _ is special syntax in dart which turn a class which is normally a public class into a private class. we also can use _ front of variable and function to make it private.