This file contains hidden or 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( | |
| MaterialApp(home: MyWidget(), debugShowCheckedModeBanner: false), | |
| ); | |
| } | |
| class MyWidget extends StatelessWidget { | |
| @override |
This file contains hidden or 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
| def localProperties = new Properties() | |
| def localPropertiesFile = rootProject.file('local.properties') | |
| if (localPropertiesFile.exists()) { | |
| localPropertiesFile.withReader('UTF-8') { reader -> | |
| localProperties.load(reader) | |
| } | |
| } | |
| def flutterRoot = localProperties.getProperty('flutter.sdk') | |
| if (flutterRoot == null) { |
This file contains hidden or 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() { | |
| try { | |
| print('going to throw an exception'); | |
| int.parse("some string"); | |
| } | |
| catch (exception) { | |
| print(exception); | |
| } | |
| finally{ | |
| print('this always runs'); |
This file contains hidden or 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() { | |
| List<FullName> fullNamesList = [FullName('Abe','Lincoln'), FullName('Babe', 'Ruth'), FullName('Carry', 'Bradshaw'),]; | |
| print ('fullNamesList:\n${fullNamesList.toString()}\n'); | |
| fullNamesList.sort((a,b) => a.lastName.compareTo(b.lastName)); | |
| print ('fullNamesList after sort by lastName:\n$fullNamesList\n'); | |
| fullNamesList.sort((a,b) => a.firstName.compareTo(b.firstName)); | |
| print ('fullNamesList after sort by firstName:\n$fullNamesList\n'); | |
| } |
This file contains hidden or 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(){ | |
| FullName myName = FullName('Tailor', 'VJ'); | |
| print(myName); | |
| } | |
| class FullName{ | |
| String firstName; | |
| String lastName; | |
| FullName(this.firstName, this.lastName); | |
| String toString(){ |
This file contains hidden or 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(){ | |
| Map map1 = {1: 'one', 2: 'two'}; | |
| Map map2 = {3: 'three', 4: 'four'}; | |
| Map map3 = {...map1, ...map2}; | |
| print('map1: $map1'); | |
| print('map2: $map2'); | |
| print('map3: $map3'); | |
| } |
This file contains hidden or 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(){ | |
| Map<String, int> scores = {'Bob': 300}; | |
| print('Initial state of the scores Map: $scores'); | |
| for (var key in ['Bob', 'Rohan', 'Sophena']) { | |
| scores.putIfAbsent(key, () => key.length); | |
| } | |
| for (MapEntry entry in scores.entries){ | |
| print('scores[\'${entry.key}\']: ${entry.value}'); |
This file contains hidden or 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()); | |
| /// This Widget is the main application widget. | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( |
This file contains hidden or 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
| main() { | |
| var list = ['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon']; | |
| for (var item in list){ | |
| print('${list.indexOf(item)}: $item'); | |
| } | |
| } |
NewerOlder