[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

猜你喜欢

转载自www.cnblogs.com/Answer1215/p/9384095.html