Explore tens of thousands of sets crafted by our community.
Dart Language Features
36
Flashcards
0/36
First-Class Functions
Functions in Dart are first-class citizens, meaning they can be passed as arguments to other functions, assigned to variables, and returned from functions.
Dart Null Safety
Null safety in Dart means that variables can't hold null values by default, preventing null reference exceptions.
Asynchronous programming with Futures and Streams
Dart handles asynchronous operations with Futures and Streams, allowing you to write code that can execute in the background.
Strongly Typed Language
Dart is a strongly typed language, meaning that the type of variable is known at compile time. This helps catch errors early in the development process.
Generics
Dart supports generics, allowing you to write code that can work with any type in a type-safe way.
Isolates for Concurrency
Dart uses isolates as a way to handle concurrency, with each isolate having its own memory and running in its own thread.
Extension Methods
Dart allows you to add new functionality to existing classes via extension methods without modifying the original class.
Named Constructors
Dart classes can have multiple constructors with different names, allowing you to initialize your objects in various ways.
Mixin-based Inheritance
Dart supports mixin-based inheritance, allowing you to create a class body that can be reused in multiple class hierarchies.
Collection if and spread
The collection if and spread operators provide a concise way to conditionally insert items or merge multiple collections within lists or maps.
Assertions
An assertion is a runtime check that a boolean condition is true, used during debugging to ensure that an unexpected situation does not occur.
Late Variables
The 'late' keyword is used to delay initialization of a variable until it is actually used, which can help avoid null errors and potentially improve startup time.
Named Parameters
Dart functions can have named parameters, which allow you to specify arguments by their name for better readability and to make arguments order-independent.
Metadata Annotations
Dart provides metadata annotations, which can be used to provide additional information about the code to tools, compilers, or for reflection at runtime.
Exception Handling
Dart provides exception handling with try-catch blocks. You can catch specific exceptions or use a final block to execute code after an exception has been handled.
Control Flow Collections
Dart offers syntax to include if statements and for loops inside collections, which help in creating dynamic collections.
Typedefs
A typedef in Dart is used to create a user-defined name for a function type that can be used when declaring variables and return types.
Getters and Setters
Dart allows you to define getters and setters for your classes to control and validate changes to an object's properties, similar to other object-oriented languages.
Enums
Dart supports enumerations (enums), which are a set of named constant values. Enums are useful for defining a common set of related values.
Sound Type System
The Dart type system is sound, which means that if a variable is of a certain type, the compiler guarantees that it will always be of that type.
Library and Visibility
Dart uses libraries to organize and share code. A library can restrict the visibility of its content to other files with '_underscore' prefixes.
Static Members
Dart supports static methods and properties, which belong to the class itself rather than instances of the class.
Operator Overloading
Dart allows you to provide custom implementation for existing operators for your class using the operator keyword.
String Interpolation
Dart allows inserting values directly into strings without concatenation, through string interpolation, by using the '\\
Cascades Notation (..)
Cascades (..) allow you to make a sequence of operations on the same object. This results in more fluent code and avoids the need to save the instance in a temporary variable.
Factory Constructors
Factory constructors enable a class to have multiple constructors that can return objects of various types, including subtypes or pre-existing instances.
The 'required' keyword
The 'required' keyword is used to specify that a named parameter in a function or constructor must be provided; it prevents the omission of parameters that are essential for a function's execution.
Cascade Operator (..)
The cascade operator (..) allows you to perform a sequence of operations on the same object.
Interoperability with JavaScript
Dart can interoperate with JavaScript, allowing you to use JavaScript libraries in your Dart applications with the help of the js package.
Lambdas
Dart supports lambda expressions — anonymous functions that are concise and can be passed around as arguments.
Multi-Threaded Programming with Isolates
Dart uses isolates to achieve concurrency, isolates are separate workers that don't share memory but can pass messages between each other.
Conditional Import
Dart supports conditional imports which make it possible to have different implementations of a library for different platforms.
Iterable spreads
In Dart, you can use the spread operator (...) to insert all elements of an iterable (like a list, set) into a collection.
Records (proposed feature)
Dart is considering adding records as a language feature to provide a simple way to represent data structures with value-based equality.
Type Promotion
Dart's control flow analysis promotes types within if-statements, which simplifies the handling of nullable types.
Collection Literals
Dart provides collection literals for easily creating lists, sets, or maps.
© Hypatia.Tech. 2024 All rights reserved.