Fireship · @fireship

Dart in 100 Seconds

Uploaded October 13, 2021 · Length 2:31

Dart in 100 Seconds

Summary

Dart language basics, features, and use cases for building fast apps on multiple platforms.

  • dart programming language
  • flutter framework
  • typesafe language
  • general purpose language

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    Dart a typesafe general purpose

  2. 0:02

    programming language designed for

  3. 0:03

    building fast apps on multiple platforms

  4. 0:06

    it was developed by Google and first

  5. 0:08

    appeared in 2011 and was intended to be

  6. 0:10

    an alternative to JavaScript by shipping

  7. 0:12

    its own virtual machine to run apps in

  8. 0:14

    the browser but things got off to a

  9. 0:16

    rocky start and it was never really

  10. 0:17

    embraced by the web development

  11. 0:19

    Community however it bounced back in a

  12. 0:21

    big way after being adopted by the

  13. 0:23

    flutter framework and today it's one of

  14. 0:25

    the most loved programming languages in

  15. 0:26

    the industry it's Unique for its ability

  16. 0:28

    to compile to multiple tar targets like

  17. 0:30

    arm and x64 machine code for mobile

  18. 0:32

    devices JavaScript for web browsers and

  19. 0:35

    self-contained executables for Windows

  20. 0:38

    Mac OS and Linux it also has a just in

  21. 0:41

    time or jit compiler which compiles your

  22. 0:43

    source code to machine code on the Fly

  23. 0:45

    which can boost developer productivity

  24. 0:47

    with features like hot reload and

  25. 0:48

    flutter all dark code runs inside of an

  26. 0:50

    isolate which is like a chunk of memory

  27. 0:52

    running a single-threaded event Loop

  28. 0:54

    this makes it possible to perform

  29. 0:56

    asynchronous background work on a single

  30. 0:57

    thread but you can also spawn multiple

  31. 1:00

    lets to run code in parallel the

  32. 1:02

    language itself is type safe which means

  33. 1:04

    that a variable's value always matches

  34. 1:06

    its static type and that generally

  35. 1:08

    results in fewer runtime errors for your

  36. 1:09

    app in production however the type

  37. 1:11

    system is flexible allowing you to use

  38. 1:13

    Dynamic types and runtime checks when

  39. 1:15

    required it also provides null safety

  40. 1:17

    which means that values can't be null

  41. 1:19

    unless you explicitly allow them to be

  42. 1:21

    which can further cut down runtime

  43. 1:23

    exceptions syntactically it's often

  44. 1:25

    described as combining elements of java

  45. 1:28

    and JavaScript a DART program program

  46. 1:30

    always starts with a main function that

  47. 1:32

    has no return value so it's annotated

  48. 1:34

    with the void type inside of it we might

  49. 1:36

    declare a variable with VAR and set it

  50. 1:38

    equal to a string Dart will

  51. 1:39

    automatically infer this as a string

  52. 1:41

    type however we could explicitly type it

  53. 1:43

    by replacing bar anything you can store

  54. 1:45

    in a variable is an object and every

  55. 1:47

    object is an instance of a class the

  56. 1:50

    only thing that's not an object in Dart

  57. 1:51

    is null this opens the door to multiple

  58. 1:54

    programming paradigms functions are also

  59. 1:56

    first class objects which means they can

  60. 1:58

    be passed around for functional program