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() { | |
f2(f1, 3); | |
f2(f1, 4); | |
f2(f1, 7); | |
f2(f1, 9); | |
} | |
f1(int evenOrOdd) { | |
print("$evenOrOdd is ${evenOrOdd % 2 == 0 ? "Even" : "Odd"}"); | |
} |
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
import 'package:flutter/material.dart'; | |
void main() => runApp(ProductiveApp()); | |
class ProductiveApp extends StatefulWidget { | |
@override | |
_ProductiveAppState createState() => _ProductiveAppState(); | |
} | |
class _ProductiveAppState extends State<ProductiveApp> { |
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() { | |
User() | |
..firstName = "Laxman" | |
..lastName = " Bhattarai" | |
..age = 18 | |
..printUser(); | |
} | |
class User { | |
String firstName; |
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
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold(body: SliverAppBarDemo()), |
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() { | |
group("Exception/Error testing", () { | |
test("test method that throws errors", () { | |
expect(_testError(fails: false), false); | |
expect(() => _testError(fails: true), throwsA(isA<FooError>())); | |
}); | |
}); | |
} |
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() { | |
var numbers = [1, 2, 3]; | |
var names = ["Smith", "Laxman"]; | |
List<int> nullList; | |
List<int> getLostNumbers() => null; | |
//This is long way | |
print("\n\n\nLong Way"); | |
var list = List(); | |
list.addAll(numbers); |
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() { | |
var member = CallableClass(); | |
member("Flutter"); | |
} | |
class CallableClass{ | |
// Define method with name `call` which will be called. | |
call(String name){ | |
print("Name is $name"); | |
} |
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
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
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
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
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() { | |
normalFunction("Laxman", "Bhattarai", 26, 65); | |
optionalFunction("Laxman", "Bhattarai"); | |
optionalFunction("Laxman", "Bhattarai", age: 26); | |
optionalFunction("Laxman", "Bhattarai", weight: 65); | |
optionalFunction("Laxman", "Bhattarai", weight: 65, age: 26); | |
positionalFunction("Laxman", "Bhattarai"); | |
positionalFunction("Laxman", "Bhattarai", 26); |