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'; | |
| class MyCallbackPage extends StatefulWidget { | |
| const MyCallbackPage({super.key}); | |
| @override | |
| State<MyCallbackPage> createState() => _MyCallbackPageState(); | |
| } | |
| class _MyCallbackPageState extends State<MyCallbackPage> { |
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'; | |
| class ParentWidget extends StatefulWidget { | |
| const ParentWidget({super.key}); | |
| @override | |
| State<ParentWidget> createState() => _ParentWidgetState(); | |
| } | |
| class _ParentWidgetState extends State<ParentWidget> { |
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'; | |
| class Counter extends StatefulWidget { | |
| const Counter({super.key}); | |
| @override | |
| State<Counter> createState() => _CounterState(); | |
| } | |
| class _CounterState extends State<Counter> { |
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() { | |
| int a = 16; | |
| int b = 5; | |
| var c = a / b; // Division operator | |
| print('c = $c'); // Returns division result - double values | |
| var i = a ~/ b; // Tilde slash operator | |
| print('i = $i'); // Returns integer part of division result |
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() { | |
| var command = 'OPEN'; | |
| switch (command) { | |
| case 'CLOSED': // Empty case falls through. | |
| // case 'CLOSED': | |
| // print('CLOSED'); | |
| // break; // Omitting a break statement will show error | |
| // case 'PENDING': | |
| // print('PENDING'); |
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() { | |
| int year = 1999; | |
| List<String> planets = ['Jupiter', 'Saturn', 'Uranus', 'Neptune']; | |
| if (year >= 2001) { | |
| print('21st century'); | |
| } else if (year >= 1901) { | |
| print('20th century'); | |
| } |
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() { | |
| int a = 16; | |
| int b = 5; | |
| var c = a / b; // Division operator | |
| print('c = $c'); // Returns division result - double values | |
| var i = a ~/ b; // Tilde slash operator | |
| print('i = $i'); // Returns integer part of division result |
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
| // ignore_for_file: use_key_in_widget_constructors | |
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| // ignore: must_be_immutable |
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() { | |
| // Single line comments | |
| /* | |
| Blocks of comments. | |
| */ | |
| /// Documentation | |
| /// | |
| /// This is what you should use to document your classes. |
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() { | |
| print('Hello world!'); | |
| } |
NewerOlder