This repo contains all the exercises and solutions from my Dart Course.
- Making the most of this course
- Introduction to Dart
- Introduction to Dartpad
- Section Intro
- The
mainmethod - Hello world
- Variable declaration and initialization
- Basic types
- Exercise: printing variables
- String Concatenation & Interpolation
- Exercise: String interpolation
- String Escaping
- Multi-line strings
- Basic String operations: uppercase and lowercase
- Initialization vs Assignment
- Exercise: Lowercase and uppercase strings
- Finding and replacing strings
- Conversions between types
- Arithmetic operators
- Exercise: temperature conversion
- Increment & decrement operators
- Logical & Relational operators
- Ternary conditional operator
- Hex format, bitwise & shifting operators
- Comments
- Expressions & statements
- Section Intro
- Static vs Dynamic Languages
- Type inference with
var - The
finalkeyword - The
constkeyword - Exercise:
var,finalandconst - The
dynamickeyword
- Section Intro
- If/else statements
- Exercise: if/else statements
- while loops
- for loops
- Exercise: fizz buzz
breakandcontinue- switch statements
- enumerations
- Exercise: simple calculator
- Section intro
- Installing the Dart SDK
- Installing and configuring VS Code
- Project Brief: Rock, Paper & Scissors
- Creating a command line app
- Pseudocode for the game logic
- Getting use input with stdin from dart:io
- Implementing the game loop
- Implementing the game logic
- Section Intro
- Lists
- Exercise: Sum of the items in a list
- List methods
- Type annotations with lists
- Using
var,final,constwith lists - Sets
- Exercise: Sets
- Maps
- The
asoperator - The
nullvalue - Iterating on maps
- Exercise: Pizza Ordering
- Nested Collections
- Exercise: Restaurant ratings
- Collection-if
- Collection-for
- Spreads
- Exercise: Shopping List
- Copying collections
- Section Intro
- Parsing command line arguments
- Reading files line by line
- Pseudocode for the processing logic
- Implementing the processing logic
- Introduction to Null Safety
- Nullable and non-nullable variables
- Flow Analysis: Promotion and Definite Assignment
- The assertion operator
- The if-null operator
- Null Safety with type inference
- Null Safety with collections
- The conditional access operator & the billion dollar mistake
- Section Intro
- Intro to functions
- Function arguments
- Return values
- Exercise: Sum of a list of numbers
- Named and positional arguments
- Required and default values
- Default positional arguments
- Exercise: Pizza ordering with functions
- Fat arrow notation
- The global and local scope
- Inner Functions
- Global mutable state and functions with side effects
- Section Intro
- Anonymous functions
- Functions as first class objects
- Function types
- Closures
- The
forEachmethod - The
mapmethod IterableandtoList()- Code reuse with anonymous functions and generics
- The
whereandfirstWheremethods - Exercise: Implement the
wherefunction - Exercise: Implement the
firstWherefunction - The
reducemethod - Combining functional operators
- Section Intro
- Introduction to classes
- Instance methods
- Class constructors and the
thiskeyword - Initializer lists and the shorthand syntax
- Classes with immutable members
- Exercise: Creating a
Personclass - Type safety with classes
constconstructors- Named constructors
- Named constructors: temperature example
- Getters and setters
- Exercise: Restaurant ratings with classes
- Static methods and variables
- Private variables and methods
- Wrap up
- Section Intro
- VS Code Dart Setup with Null Safety
- Introduction to inheritance / subclassing
- The
superconstructor - Overriding methods
- Abstract classes
- Exercise: Area and Perimeter
- Interfaces and the difference between
implementsandextends - The base
Objectclass - The
toString()method - The equality operator and the
covariantkeyword - Exercise: Implement the + and * operators
- Overriding
hashCodeand the Equatable package - Using classes with generics
- Composition vs inheritance: Flutter widget hierarchy example
- Factory constructors and reading JSON data
- Exercise: JSON Serialization
- Copying objects with
copyWith - The cascade operator
- Simple eCommerce store: Overview
- Creating the Product, Item, Cart classes
- Adding the interactive prompt
- Adding items to the cart
- Checkout functionality
- Project structure and wrap-up
- Section Intro
- Creating and using mixins
- Mixins: Drawbacks
- Extensions
- Extensions with generic type constraints
- Exercise: Range extension
- Section Intro
- Errors vs Exceptions
- Assertions
- Exceptions:
throw,try,catch,finally,rethrow - Exercise: Email validation
- Section Intro
- Futures,
then,catchError,whenComplete asyncandawaitFuture.valueandFuture.error- Exercise: Countdown with Futures
- Streams
- Stream generators:
async*andyield - Exercise: Fizz-buzz with streams
- Stream constructors
- Stream methods
- Single / multiple subscription streams
- Weather App Overview
- REST API Basics
- Creating the command-line app
- Creating a Weather API Client with the Dart http package
- Reading the response status code and data
- Completing the Weather API client
- Parsing JSON Data
- Error Handling and Wrap up
- BONUS Content: Free Dart eBook & Next Steps
