Created with <3 with dartpad.dev.
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
| class DummyModel { | |
| const DummyModel({required this.title, required this.categories}); | |
| final String title; | |
| final List<String> categories; | |
| } | |
| const kDummies = [ | |
| DummyModel( | |
| title: "first", | |
| categories: ["a", "b", "c", "d", "e"], |
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 numRaces = 8; | |
| var tracksSelected = [1, 2, 3]; | |
| var finalTrackList = []; | |
| // Add tracksSelected.length tracks at a time to finalTrackList | |
| do { | |
| print("outer loop"); |
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
| int globalVar = 400; | |
| void main() { | |
| int abc = 123; | |
| print("abc in main() - $abc"); | |
| print("globalVar in main() - $globalVar\n"); | |
| updateMyVars(abc: abc); | |
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<String> letters = ["a", "b", "c"]; | |
| // The next two variables are random whatever, | |
| // but used to show we can manipulate them inside of our loops | |
| // We can do more than print()! | |
| // Just happen to use print() a lot to learn, visualize, and debug | |
| // That's about all you use it for actually, app user will never see your print()s | |
| List<String> allLetters = []; | |
| int growingNumber = 2; |
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
| /* | |
| Fibonacci sequence - 0, 1, 1, 2, 3, 5, 8, 13... | |
| Write a function that takes in the number of the Fibonacci sequence | |
| that I want to find and it will return that number. | |
| For example, if I pass in 8, the function will return 13. I'll print | |
| the number in main(). | |
| I already know that the first two numbers in the sequence are 0 and 1, |
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(const MainApp()); | |
| } | |
| class MainApp extends StatelessWidget { | |
| const MainApp({super.key}); | |
| @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
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(const MainApp()); | |
| } | |
| class MainApp extends StatelessWidget { | |
| const MainApp({super.key}); | |
| @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
| void main() { | |
| // Tag an event from somewhere in the app | |
| var event = EventModel(eventAction: "App Opened"); | |
| postAnalyticsDetails(event); | |
| } | |
| // Treat all of the optional parameters like feedbackRating if we want to pass empty string | |
| // or like feedbackMaxRating if it turns out we need to provide null for optional parameters | |
| class EventModel { | |
| EventModel({ |
Created with <3 with dartpad.dev.
NewerOlder