Use the 'const' keyword to define a compile-time constant.
Use square brackets, e.g., var list = [1, 2, 3];
The default value is 'null'.
Use the 'void' keyword or specify a return type, e.g., void myFunction() {}
The 'final' keyword is used to define a variable that can only be set once.
Use '//', e.g., // This is a comment.
Dart uses '==' for equality comparison; '===' is not used in Dart.
Use the 'is' keyword, e.g., if (variable is String) {}
The 'main()' function is the entry point.
Use the '+' operator or string interpolation with '\$'.
String interpolation allows embedding expressions in strings using '\$'.
Use 'try-catch' blocks to handle exceptions.
The 'async' keyword is used to define asynchronous functions.
Use curly braces, e.g., var map = {'key': 'value'};
'const' variables are compile-time constants, while 'final' variables are runtime constants.
Null safety ensures that variables cannot contain 'null' unless explicitly allowed, reducing runtime errors.
Use the 'class' keyword, e.g., class MyClass {}
A mixin is a way to reuse a class's code in multiple class hierarchies using the 'mixin' keyword.
Use the 'extends' keyword, e.g., class Child extends Parent {}
The 'factory' keyword is used to define a constructor that can return an instance of a subtype or an existing instance.
Use the 'abstract' keyword, e.g., abstract class MyClass {}
The 'async*' keyword is used to define an asynchronous generator that yields multiple values.
A 'Future' represents a single asynchronous result, while a 'Stream' provides a sequence of asynchronous results.
Use the '@override' annotation and redefine the method in the subclass.
The 'static' keyword is used to define class-level variables and methods that do not require an instance.
Use 'try-catch' blocks or the 'onError' callback for Futures and Streams.
'late' is used for deferred initialization, while 'lazy' refers to initializing only when accessed.
Use the 'implements' keyword, e.g., class MyClass implements MyInterface {}
The 'typedef' keyword is used to define a function type alias for better readability and reusability.
Define an extension using the 'extension' keyword, e.g., extension MyExtension on String {}
The 'covariant' keyword is used to allow a parameter's type to be overridden in a subclass.
Use angle brackets, e.g., class MyClass
An 'isolate' is a separate thread of execution used for concurrency in Dart.
Use a private constructor and a static instance, e.g., class Singleton { Singleton._privateConstructor(); static final instance = Singleton._privateConstructor(); }
The 'deferred' keyword is used for lazy loading of libraries to improve app performance.
The 'await for' loop is used to process each event in a Stream asynchronously.
'const' constructors create compile-time constants, while normal constructors initialize objects at runtime.
Use the 'operator' keyword, e.g., MyClass operator +(MyClass other) {}
The 'rethrow' keyword is used to propagate an exception after catching it.
Define annotations with '@', e.g., @override or custom annotations like @MyAnnotation.
Synchronous generators use 'sync*', while asynchronous generators use 'async*' to yield values.
Define a call() method in the class, e.g., class MyClass { void call() {} }
The 'external' keyword is used to declare a function or method that is implemented outside of Dart.
The 'zone' API is used to manage asynchronous operations and error handling in a specific context.
'Unmodifiable' collections cannot be changed after creation, while 'immutable' collections are deeply immutable.
Use the 'on' keyword to specify constraints, e.g., mixin MyMixin on MyBaseClass {}
The 'noSuchMethod' method is invoked when a non-existent method or property is accessed.
Define an extension, e.g., extension MyExtension on String { String reverse() => split('').reversed.join(); }
Dart does not have a separate 'interface' keyword; abstract classes can act as interfaces when implemented.
Use tools like the Dart DevTools and ensure proper disposal of resources like Streams and Controllers.