Skip to content

My journey as a Flutter developer, from zero to hero. Repo is my course work, including everything that I have learnt about flutter and dart.

Notifications You must be signed in to change notification settings

hashirshoaeb/flutter-tales

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Flutter Tales 🚀

A Flutter project for practice and example codes.

About Me · Report Bug · Request Feature

GitHub contributors GitHub stars GitHub forks GitHub issues GitHub license Twitter Follow

Apps

Lab work

Assignments

Getting Started

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Method to Run

In order to run your application from terminal, type:

  $flutter emulators

Shows available emulators.

  • To run an emulator, run 'flutter emulators --launch '.
  • To create a new emulator, run 'flutter emulators --create [--name xyz]'.
  $flutter emulators --launch iOS Simulator
  $cd first_app
  $flutter run

DART

What is Dart

Dart is an object oriented programming language. It is primarily used for creating frontend user interfaces. And it is strongly typed.

Variables, Functions, Types

Variables are used to temporarily store data.

 var name = 'Hashir';
 print(name); // Outputs ‘Hashir’

Here, var keyword is used to create variable. Equal(=) operator is used to assign value to the variable. And print() function is used to log the output.

Tip: It's common to use camelCase notation to name the variable.

In above example, variable name is of type String. Since Dart is able to infer the type though (because you initialise the variable with a value - 'Hashir'). It can also be written as follows.

String name = 'Hashir';
print(name); // Outputs 'Hashir'

Types describe the type of data of a variable. With types, you can ensure that a certain code expression only accepts numbers and the compiler “yells at you” if you pass wrong data.

Type Example More Information
String String myName = 'Max'; Holds text. You can use single or double quotes - just be consistent once you made your choice.
num, int, double int age = 30; double price = 9.99; num refers to “number” - there are two types of numbers in Dart: Integers (numbers without a decimal place) and doubles (numbers with decimal places)
object Person = Person(); Generally, everything in Dart is an object - even an integer. But objects can also be more complex, see below.

Functions allow you to define code snippets which you can call whenever and as often as you want.

void sayHello(String name) {
  print('Hello ' + name);
}

double addNumbers(double n1, double n2) {
  return n1 + n2;
}

Objects & Object-orientation

Dart is an object-oriented programming language - that means that every value in Dart is an object, even primitive values like text (= String) or numbers (= Integers and Doubles).

Objects are data structures and created with the help of “Classes” because every object needs a blueprint (=> the class) based on which you can then create (“instantiate”) it.

class Person {
  var name = 'Max';
  var age = 30;

  void greet() {
  print('Hi, I am ' + name + ' and I am ' + age.toString() + ' years old!';
  }
}

The class only serves as a blueprint though! On its own, it does not give you an object! Instead, you can now create objects based on this class:

void main() {
  var myself = Person();
  print(myself.name); // use the . to access class properties & methods
}

Positional & Named Arguments

  • annonymus function jiska koi nam na ho,
  • press 'Command' and hover the class object, to
  • final vs const final is called a run time constant. when you code and made final, but you dont know the value to it, but know know what are you assigning to const eg:

Flutter

  • Pascel notation
  • class is a widget
  • we are creating a widget tree
  • extend use to inherite
  • this is a builder widget.
  • flutter takes the control on screen pixcels
  • every widget in flutter is actaully a dart class with a - build method.
  • Scaffold is a design widget

Stateless widgets are immutable, meaning that their properties can’t change—all values are final. Two types of widgets:

  • Stateless - which does not save the state
  • Statefull - which maintains the state - like cookies, login sessions

there are two type of arguments like in python, positional aggumaents , named arguments Stateful widgets maintain state that might change during the lifetime of the widget. Implementing a stateful widget requires at least two classes: 1) a StatefulWidget class that creates an instance of 2) a State class. The StatefulWidget class is, itself, immutable, but the State class persists over the lifetime of the widget. flutter has control on each and every pixel of screen.

visible widget. => for handling input and output, eg. button invisible widget => for handling layout and control eg. column

About

My journey as a Flutter developer, from zero to hero. Repo is my course work, including everything that I have learnt about flutter and dart.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published