[Dart] Understand Variables and Constants in Dart


In this lesson, we will look at how to create variables and constants. These are containers that store data for later reference and/or retrieval.

Dart is an object-oriented programming language by Google, which aims to help the developer build modern web applications. It covers client, server and now mobile with Flutter. It comes with a range of tools including a virtual machine, core libraries, and package management repository, lending enough ammunition to start your next project.

Learn more at https://dartlang.org

 

final

  final c = new DateTime(2018);
  // c = 'Hello again'; // Uncomment to throw
  print(c);

 

const

const d = new DateTime(2018) // Error const doesn't work with constructor

 

posted @ 2018-07-29 02:48  Zhentiw  阅读(154)  评论(0编辑  收藏  举报