This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int number = 2; | |
num number2 = 2.0; | |
double number3 = 3; | |
String str = 'Abdulloh'; | |
final list = [1, 2, 3]; | |
final map = {1: 'one', 2: 'two', 3: 'three'}; | |
final mapValue = map[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String? nullString = 'Abdulloh'; | |
void main() { | |
nullString = null; | |
print (isNullString(nullString)); | |
} | |
bool isNullString(String? someNullablesString) { | |
if (someNullablesString == null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
//final one = int.parse('one'); //error | |
final two = double.parse('2.2'); //successful | |
final three = int.tryParse('one'); //null | |
final four = double.tryParse('4.5'); //successful | |
final one = int.parse('3'); | |
print(''' | |
$two | |
$three |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var number1 = 20; | |
var number2 = 10; | |
void main() { | |
final plus = number1+number2; | |
final minus = number1-number2; | |
final multiply = number1*number2; | |
final devision = number1/number2; | |
final devisionWithReminder = number1~/(number2+2); | |
final reminderOfDevision = number1%(number2+2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Weekdays { | |
monday, | |
tuesday, | |
wednesday, | |
thursday, | |
friday, | |
saturday, | |
sunday | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
final String name; | |
final int age; | |
Person(this.name, this.age); | |
Person.born() : name = 'Abdulloh', age = 15; | |
factory Person.zero() { | |
final one = Person.born().age-7; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Person { | |
String get name; | |
int get age; | |
void speak(String name, int age); | |
void walk() { | |
print('walk'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myAge = 15; | |
const isTeenager = (13 >= 19); | |
const maryAge = 30; | |
const bothTeenagers = (myAge == isTeenager) && (maryAge == isTeenager); | |
const reader = 'Abdulloh'; | |
const ray = 'Ray Wenderlich'; | |
const rayIsReader = (ray == reader); | |
void main() { | |
print(bothTeenagers); |