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
main
method - 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
final
keyword - The
const
keyword - Exercise:
var
,final
andconst
- The
dynamic
keyword
- Section Intro
- If/else statements
- Exercise: if/else statements
- while loops
- for loops
- Exercise: fizz buzz
break
andcontinue
- 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
,const
with lists - Sets
- Exercise: Sets
- Maps
- The
as
operator - The
null
value - 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
forEach
method - The
map
method Iterable
andtoList()
- Code reuse with anonymous functions and generics
- The
where
andfirstWhere
methods - Exercise: Implement the
where
function - Exercise: Implement the
firstWhere
function - The
reduce
method - Combining functional operators
- Section Intro
- Introduction to classes
- Instance methods
- Class constructors and the
this
keyword - Initializer lists and the shorthand syntax
- Classes with immutable members
- Exercise: Creating a
Person
class - Type safety with classes
const
constructors- 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
super
constructor - Overriding methods
- Abstract classes
- Exercise: Area and Perimeter
- Interfaces and the difference between
implements
andextends
- The base
Object
class - The
toString()
method - The equality operator and the
covariant
keyword - Exercise: Implement the + and * operators
- Overriding
hashCode
and 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
async
andawait
Future.value
andFuture.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