DMarlon Studio

Basic Dart course

From scratch: everything you need to write your first programs. In DMarlon Studio, Dart is the language of the Flutter targets (mobile and desktop): design the screens on the phone canvas and the studio writes the Dart.

Start
  1. 1Hello, worldYour first Dart program: the main() function, print() for text and numbers, single or double quotes, and the semicolon.Lesson 1
  2. 2var, final, const and typesDeclare Dart variables with their type (String, int, double, bool), with var, final and const, and check each value's type with runtimeType.Lesson 2
  3. 3Numbers and arithmeticDo arithmetic in Dart: +, -, *, division with / that gives a double, integer division ~/ and remainder %, rounding, and the += and ++ operators.Lesson 3
  4. 4Strings and interpolationWork with text in Dart: joining strings with +, interpolation with $ and ${}, characters by index, escapes, multi-line strings and the * operator.Lesson 4
  5. 5Reading inputRead what the user types in Dart with stdin.readLineSync() from dart:io and turn it into numbers with int.parse, double.parse and int.tryParse.Lesson 5
  6. 6if, else and the conditional operatorMake decisions in Dart with if, else if and else, combine conditions with &&, || and !, and pick a value in one line with the ? : operator.Lesson 6
  7. 7switch and switch expressionsChoose between many cases with switch in Dart 3: the classic statement, the new switch expression with =>, patterns such as || and >=, and when guards.Lesson 7
  8. 8for, while and do-whileRepeat code in Dart with for, while and do-while loops, and control each turn with break and continue: a times table, savings and a countdown.Lesson 8
  9. 9ListsStore several values in order with Dart lists: List<String>, indexes from 0, first and last, looping with for-in, contains and indexOf.Lesson 9
  10. 10Working with listsChange lists in Dart: add with add, addAll and insert, take out with remove, removeAt and removeLast, order with sort and copy parts with sublist.Lesson 10
  11. 11SetsUse Dart sets to store values without repeats: remove duplicates with toSet() and compare hobbies with intersection, union and difference.Lesson 11
  12. 12MapsStore key-value pairs in a Dart Map: a café menu with [], ??, remove, containsKey, entries and a count of orders.Lesson 12
  13. 13Functions and arrow syntaxWrite Dart functions with a return type, return and the => arrow syntax, use void, and store functions in variables: a temperature converter.Lesson 13
  14. 14Named and optional parametersMake flexible Dart functions with optional parameters in [ ], named parameters in { }, default values and required.Lesson 14
  15. 15Null safetyUnderstand Dart's null safety: nullable types with ?, the ??, ?., ! and ??= operators, and how an if != null check changes the type.Lesson 15
  16. 16String methodsHandle text in Dart with trim, toUpperCase, contains, indexOf, replaceAll, substring, split, join, padLeft and padRight.Lesson 16
  17. 17forEach, map, where, reduce and foldGo through and transform Dart collections with forEach, map, where, reduce and fold, and chain them to filter, convert and add up in one go.Lesson 17
  18. 18ExceptionsHandle errors in Dart with try, on, catch and finally, and raise your own with throw: a cash machine that refuses negative amounts and overdrafts.Lesson 18
  19. 19Writing and reading filesSave and read text files in Dart with the File class from dart:io: writeAsStringSync, FileMode.append, readAsStringSync and readAsLinesSync.Lesson 19
  20. 20Project: shopping cartA Dart project that brings the course together: a shopping cart with maps, functions, exceptions, null safety, fold and a switch expression for the discount.Lesson 20