Dart Course | Code With Andrea
This repo contains all the exercises and solutions from my Dart Course.
Course Syllabus
1. Introduction
- Making the most of this course
- Introduction to Dart
- Introduction to Dartpad
2. Dart Basics
- 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
3. Dart type system
- Section Intro
- Static vs Dynamic Languages
- Type inference with
var
- The
final
keyword - The
const
keyword - Exercise:
var
,final
andconst
- The
dynamic
keyword
4. Control flow
- Section Intro
- If/else statements
- Exercise: if/else statements
- while loops
- for loops
- Exercise: fizz buzz
break
andcontinue
- switch statements
- enumerations
- Exercise: simple calculator
5. Project: Building a command line app
- 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
6. Collections
- 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
7. Project: Data Processing in Dart
- Section Intro
- Parsing command line arguments
- Reading files line by line
- Pseudocode for the processing logic
- Implementing the processing logic
8. Dart Null Safety
- 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
9. Functions: Basics
- 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
10. Functions: Advanced
- 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
11. Classes: Basics
- 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
12. Classes: Advanced
- 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
13. Project: Simple eCommerce
- 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
14. Mixins & Extensions
- Section Intro
- Creating and using mixins
- Mixins: Drawbacks
- Extensions
- Extensions with generic type constraints
- Exercise: Range extension
15. Error Handling & Exceptions
- Section Intro
- Errors vs Exceptions
- Assertions
- Exceptions:
throw
,try
,catch
,finally
,rethrow
- Exercise: Email validation
16. Async Programming
- 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
17. Weather App
- 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
18. Conclusion & Next Steps
- BONUS Content: Free Dart eBook & Next Steps