Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed all deprecated syntax #18

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix warnings
  • Loading branch information
kach4n committed Jun 30, 2023
commit 6d4b82937d1671a026171cccba7aa2c8d1ce27db
38 changes: 19 additions & 19 deletions 02_built_in_data_types.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
// ignore_for_file: unused_local_variable

void main(List<String> arguments) {
// Numbers: int
int score = 23;
var count = 23; // It is inferred as integer automatically by compiler
int hexValue = 0xEADEBAEE;

// Numbers: int
int score = 23;
var count = 23; // It is inferred as integer automatically by compiler
int hexValue = 0xEADEBAEE;
// Numbers: double
double percentage = 93.4;
var percent = 82.533;
double exponents = 1.42e5;

// Numbers: double
double percentage = 93.4;
var percent = 82.533;
double exponents = 1.42e5;
// Strings
String name = "Henry";
var company = "Google";

// Strings
String name = "Henry";
var company = "Google";
// Boolean
bool isValid = true;
var isAlive = false;

// Boolean
bool isValid = true;
var isAlive = false;
print(score);
print(exponents);

print(score);
print(exponents);

// NOTE: All data types in Dart are Objects.
// Therefore, their initial value is by default 'null'
// NOTE: All data types in Dart are Objects.
// Therefore, their initial value is by default 'null'
}
44 changes: 21 additions & 23 deletions 03_string_and_string_interpolation.dart
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
// ignore_for_file: unused_local_variable

void main() {
// Literals
var isCool = true;
int x = 2;
"John";
4.5;

// Literals
var isCool = true;
int x = 2;
"John";
4.5;
// Various ways to define String Literals in Dart
String s1 = 'Single';
String s2 = "Double";
String s3 = 'It\'s easy';
String s4 = "It's easy";

// Various ways to define String Literals in Dart
String s1 = 'Single';
String s2 = "Double";
String s3 = 'It\'s easy';
String s4 = "It's easy";
String s5 = 'This is going to be a very long String. '
'This is just a sample String demo in Dart Programming Language';

String s5 = 'This is going to be a very long String. '
'This is just a sample String demo in Dart Programming Language';
// String Interpolation : Use ["My name is $name"] instead of ["My name is " + name]
String name = "Kevin";

print("My name is $name");
print("The number of characters in String Kevin is ${name.length}");

// String Interpolation : Use ["My name is $name"] instead of ["My name is " + name]
String name = "Kevin";
int l = 20;
int b = 10;

print("My name is $name");
print("The number of characters in String Kevin is ${name.length}");


int l = 20;
int b = 10;

print("The sum of $l and $b is ${l + b}");
print("The area of rectangle with length $l and breadth $b is ${l * b}");
print("The sum of $l and $b is ${l + b}");
print("The area of rectangle with length $l and breadth $b is ${l * b}");
}
21 changes: 10 additions & 11 deletions 04_constants.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
// ignore_for_file: unused_local_variable

void main() {
// final
final cityName = 'Mumbai';
// name = 'Peter'; // Throws an error

// final
final cityName = 'Mumbai';
// name = 'Peter'; // Throws an error
final String countryName = 'India';

final String countryName = 'India';

// const
const PI = 3.14;
const double gravity = 9.8;
// const
const PI = 3.14;
const double gravity = 9.8;
}

class Circle {

final color = 'Red';
static const PI = 3.14;
final color = 'Red';
static const PI = 3.14;
}
26 changes: 13 additions & 13 deletions 12_continue_keyword.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// ignore_for_file: unused_label

void main() {
// CONTINUE keyword
// Using Labels

// CONTINUE keyword
// Using Labels

myLoop: for (int i = 1; i <= 3; i++) {

myInnerLoop: for (int j = 1; j <= 3; j++) {

if (i == 2 && j == 2) {
continue myLoop;
}
print("$i $j");
}
}
myLoop:
for (int i = 1; i <= 3; i++) {
myInnerLoop:
for (int j = 1; j <= 3; j++) {
if (i == 2 && j == 2) {
continue myLoop;
}
print("$i $j");
}
}
}