You are on page 1of 2

flutter is a programming framework for the dart language.

It is actually a cross
native platform.

widgets are components, the building block of your user interface.

Data Types in dart:


Text,numbers,Strings,Integers,Floats

double addNumbers(double num1,double num2)


{
print(num1+num2);
}
void main()
{
addNumbers(2,2.0);
}
// To use variable in dart we use var keyword

double addNumbers(double num1,double num2)


{
print(num1+num2);
}
void main()
{
var firstResult=addNumbers(2,2.0);
print(firstResult);
}

dart also has a concept called type inference that means the var automatically
knows which data to store.

Dart is also an oops language;

class Person
{
String name="john;
int age=23;

}
double addNumbers(double num1,double num2)
{
print(num1+num2);
}
void main()
{
var P1=Person();//creating an instance /object for class person.

print (p1);// output: Instance of class.


print(p1.age);
print(p1.name);
String name="john";
int age=23;
var firstResult=addNumbers(2,2.0);
print(firstResult);
}
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
}
// we can even write main() like below:
//void main()=>runApp(MyApp());

class MyApp extends StatelessWidget {


@override //decorator optional works without it bus makes it look clear and clean
Widget build(BuildContext context) {
var questions = ['What\'s your favourite color?',
'What'\s your favourite animal?'];
//return MaterialApp(home: Text('Hello!!!')); //dart classes
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('My First App'),
),
body: Column(children:[
Text('The Question!'),
RaisedButton(child: Text('Answer 1'),onPressed: null),
RaisedButton(child: Text('Answer 2'),onPressed: null),
RaisedButton(child: Text('Answer 3'),onPressed: null),
]),
),
);
}
}

3 types of design:
material design
cupertino design
widget design

You might also like