Flutter Introduction and Dummy App Workshop
Flutter Introduction and Dummy App Workshop
Cross P
p m e n t w i th
Develo
Topics Covered
● Connect your phone and Turn on USB debugging in settings (if not already)
○ On the device, go to Settings > About <device>.
○ Tap the Build number => 7 times to make Settings > Developer options
available.
○ Then enable the USB Debugging option
● Run the App
○ CMD line => flutter run
○ VSCode => invoke Debug > Start Debugging or press F5.
A
Quick Intro
to
Language Key Points
1. int ca = 30;
2. String d = "This is a String";
3. // automatic static inference
4. var e = "This is a String Object";
5. const f = "This is a constant String Object"; // compile time
constant
6.
7. // equivalent to final String g = “This is a…”;
8. final g = "This is a final String Object";
9. // dynamic objects
10. dynamic h = 10; // it was an Int
11. h = "a String"; // but now it's a String
12. h = 10.02; // and now it's a Double
Functions
1. // function with optional positional parameter
2. int example1(int a, [int b = 10]) {
3. return a + b;
4. }
5. // function with optional named parameter
6. String example2(int a, {String str1 = "default", String str2}) {
7. return str1 + str2;
8. }
9. // lambda or arrow function (just a shorthand, returns a+b)
10. int add(int a, int b) => a + b;
11. //==========================================================
12. //=============== calling functions =====================
13. example2(10, str2: "hello", str1: "world");
String Interpolation, Async Functions and Null aware operators
1. // string interpolation
2. var a = 10, b = "number";
3. String s = "${a.toString()} is a $b"; // prints: 10 is a number
4.
5. // async function, called just like a normal function,
6. void delayPrint() async {
7. await Future.delayed(Duration(seconds: 1));
8. print("Sorry to keep u waiting");
9. }
10.
11. // Null aware operators
12. a?.toString(); // only calls toString if a is not null
13. int x = a ?? 10; // sets x to a, or 10 if a is null
A
rv i e w o f
u i c k O v e
Q
Widgets in Flutter
A minimal Flutter App
Stateless and Stateful Widgets
Slider Widget
Range: 0 - 1 (default)
Basic Widgets
Basic Widgets
Basic Widgets
a F l u t t e r
Lets make
APP
Reddit Clone
Link to Live Flutter-Web App and Full code at this repository
github.com/mannprerak2/quick_clone_reddit