Skip to content

Instantly share code, notes, and snippets.

View Haffshah's full-sized avatar
😎
Learning new things

Harsh M Shah Haffshah

😎
Learning new things
View GitHub Profile
@Haffshah
Haffshah / exmple.dart
Last active September 1, 2021 10:01
Number or Variable is Even or Odd
// Error compiling to JavaScript:
// unsupported import: dart:io in DartPad
// Also dart:io is not supported into DartPad.
// Dart:io is also not supported into Web Browser you have to run it Like mobile app only
// Also you can use other tool as well Named JDoodle : "https://www.jdoodle.com/execute-dart-online/"
import 'dart:io';
void main() {
int number;
@Haffshah
Haffshah / pattern.dart
Last active October 5, 2021 12:37
Do Write Code For Star Pattern (Any Star Pattern)
import 'dart:io';
void main(){
int n= 5;
for(int i = 1 ; i<=n; i++)
{
for(int j =i; j<n ;j++)
{
stdout.write(" ");
}
@Haffshah
Haffshah / ArithmeticOperators.dart
Last active September 8, 2021 10:46
Basic Example Arithmetic Operators used in dart using Their Function
// Types of Arithmetic Operator
// Plus +
// Minus -
// Multiplication *
// Division / with Default return type as Double
// Division ~/ with Return tyoe as Int
// -(operand) Unary Minus
void main() {
print("Example of Arithmetic operators => \n");
@Haffshah
Haffshah / Equality_and_Logical_Operators.dart
Last active September 7, 2021 11:15
Basics of Equality and Logical Operators used in Dart
// Assignment Operator in Dart
void main() {
print("Example of Equality & Logical operators => \n");
///Function Calling
Compare();
}
//Function for adding three variables
void Compare() {
@Haffshah
Haffshah / Comparison_Operator.dart
Last active September 7, 2021 11:15
Basics of Comparison Operator used in Dart
// Types OF Comparision Operators
// Greator Than >
// Less Than <
// Greator Than Equal to >=
// Less Than Equal to <=
//main Method
void main() {
@Haffshah
Haffshah / IncrDecr.dart
Last active September 7, 2021 11:14
Basic Operation of Increment & Decrement Operators used in dart
// Types of Increment & Decrement Oprators
// +=
// -=
// *=
// /=
// (operand++)
// (operand--)
// (++operand)
// (--operand)
@Haffshah
Haffshah / Loopsin.dart
Last active September 7, 2021 11:14
Basic Example of Loop Used in Dart
// Different types of loops in Dart
// while Loop
// Do While Loop
// For loop
// For In or For Each Loop
void main() {
//Function Calling
whileLoop();
@Haffshah
Haffshah / list.dart
Created September 8, 2021 10:30
Basic Examples of List Operation in dart also Function with Name parameter and optional Parameter.
void main() {
fullName("Harsh", "Shah"); // first Name , Last Name will Print
fullName("Harsh", "Shah",
"Software Developer"); //Titel, first,last name will prints
List vehical = ['Car', 'Bike', 'Cycle', 'Truck']; //list of strings
List vehical1 = ['Ship', 'Aeroplane', 'Rocket', 'Helicopter'];
final numbers = [42, -1, 299792458, 100]; // list of integers
@Haffshah
Haffshah / future.dart
Created September 11, 2021 09:08
Basic use of Future keyword , asysnc and await in dart
// Use of Ansynchronous Function adn Opration in Dart
// A future represents the result of an asynchronous operation
// it's have two states: uncompleted or completed.
// To define an async function, add async before the function body
// The await keyword works only in async functions
Future<String> createOrderMessage() async {
var order = await fetchUserOrder();
return 'Your order is: $order'; // pizza
@Haffshah
Haffshah / sublist.dart
Created September 15, 2021 11:37
Division of list into Equal parts into SubList in Dart with Easy And Lengthy Way.
// Definition : PFA Array Of Student name, by using dart pad divide all students into group of 4.
// final List<String> studentArr = <String>[
// 'Kalpit Seksariya',
// 'Gaurang Gajera',
// 'Bollam saiprakash',
// 'Dhruv Vaghela',
// 'Jaydeep Dhamecha',
// 'Jigar Pandya',
// 'Riddhi Bhavsar',