Convert Figma logo to code with AI

dart-lang logosdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.

10,061
1,555
10,061
7,274

Top Related Projects

100,112

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

48,780

The Kotlin Programming Language.

122,720

The Go programming language

67,285

The Swift Programming Language

The official repo for the design of the C# programming language

96,644

Empowering everyone to build reliable and efficient software.

Quick Overview

The dart-lang/sdk repository is the official home of the Dart programming language and its core tools. It contains the source code for the Dart SDK, including the Dart VM, compiler, core libraries, and development tools. This repository is maintained by Google and the Dart community.

Pros

  • Comprehensive ecosystem: Includes the entire Dart language implementation, core libraries, and tools
  • Active development: Regularly updated with new features, improvements, and bug fixes
  • Strong performance: Dart offers both JIT (Just-In-Time) and AOT (Ahead-Of-Time) compilation for optimal performance
  • Cross-platform support: Enables development for web, mobile, and desktop applications

Cons

  • Learning curve: May be challenging for beginners due to its comprehensive nature
  • Large repository size: Can be overwhelming for contributors or those trying to understand the entire codebase
  • Limited third-party library ecosystem compared to some other languages
  • Primarily focused on Flutter development, which may not suit all use cases

Code Examples

Since this repository contains the Dart SDK itself, it's not a code library that you would typically import and use directly in your projects. Instead, you would use the Dart SDK to develop your own applications. Here are a few examples of Dart code to illustrate its usage:

  1. Hello World example:
void main() {
  print('Hello, World!');
}
  1. Asynchronous programming with Futures:
Future<String> fetchUserData() async {
  await Future.delayed(Duration(seconds: 2));
  return 'User data fetched';
}

void main() async {
  print('Fetching user data...');
  String result = await fetchUserData();
  print(result);
}
  1. Using Dart's null safety feature:
String? nullableString = null;
String nonNullableString = 'Hello';

void main() {
  print(nullableString?.length); // Prints: null
  print(nonNullableString.length); // Prints: 5
}

Getting Started

To get started with Dart development:

  1. Install the Dart SDK from https://dart.dev/get-dart
  2. Create a new Dart project:
    dart create my_project
    cd my_project
    
  3. Run your Dart program:
    dart run
    

For more information on using Dart, visit the official documentation at https://dart.dev/guides.

Competitor Comparisons

100,112

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

Pros of TypeScript

  • Wider adoption and larger ecosystem, with more libraries and tools available
  • Closer integration with JavaScript, allowing gradual adoption in existing projects
  • More flexible type system, including union types and conditional types

Cons of TypeScript

  • Compilation step required, which can slow down development workflow
  • Type definitions for external libraries can be inconsistent or outdated
  • Learning curve for developers new to static typing in JavaScript

Code Comparison

TypeScript:

interface Person {
  name: string;
  age: number;
}

function greet(person: Person): string {
  return `Hello, ${person.name}!`;
}

Dart:

class Person {
  String name;
  int age;
  
  Person(this.name, this.age);
}

String greet(Person person) {
  return 'Hello, ${person.name}!';
}

Both languages offer static typing and object-oriented programming features. TypeScript's syntax is more familiar to JavaScript developers, while Dart has a more traditional class-based approach. TypeScript's type annotations are optional, allowing for easier integration with existing JavaScript codebases, whereas Dart enforces static typing throughout the entire codebase.

48,780

The Kotlin Programming Language.

Pros of Kotlin

  • More mature ecosystem with extensive libraries and frameworks
  • Better interoperability with Java, allowing gradual migration
  • Advanced language features like null safety and coroutines

Cons of Kotlin

  • Slower compilation times compared to Dart
  • Steeper learning curve for developers new to JVM languages
  • Larger runtime footprint than Dart

Code Comparison

Kotlin:

fun main() {
    val numbers = listOf(1, 2, 3, 4, 5)
    val doubled = numbers.map { it * 2 }
    println(doubled)
}

Dart:

void main() {
  final numbers = [1, 2, 3, 4, 5];
  final doubled = numbers.map((e) => e * 2).toList();
  print(doubled);
}

Both Kotlin and Dart are modern programming languages with similar syntax and features. Kotlin excels in its Java interoperability and mature ecosystem, making it a popular choice for Android development. Dart, on the other hand, offers faster compilation times and a smaller runtime footprint, making it ideal for cross-platform development with Flutter.

The code comparison shows that both languages have concise syntax for common operations like list manipulation. Kotlin's functional programming features are slightly more advanced, while Dart's syntax is often more straightforward for developers coming from languages like JavaScript.

122,720

The Go programming language

Pros of Go

  • Faster compilation and execution times
  • Better support for concurrent programming with goroutines and channels
  • Simpler language design, making it easier to learn and maintain

Cons of Go

  • Less flexible type system compared to Dart
  • Limited support for generic programming (prior to Go 1.18)
  • Lack of built-in UI framework for mobile and web development

Code Comparison

Go:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Dart:

void main() {
  print('Hello, World!');
}

The Go code is slightly more verbose due to its package declaration and import statement, while Dart's syntax is more concise for simple programs. Both languages have similar function declarations and print statements.

Go's standard library (fmt) is imported explicitly, whereas Dart's print function is available without imports. This reflects Go's philosophy of explicit dependencies and Dart's focus on ease of use for beginners.

Overall, Go is designed for systems programming and backend development, while Dart is more versatile, supporting both client-side and server-side development with a focus on UI frameworks like Flutter.

67,285

The Swift Programming Language

Pros of Swift

  • More mature and widely adopted in industry, especially for iOS development
  • Stronger type system and better performance optimization
  • Larger ecosystem and community support

Cons of Swift

  • Steeper learning curve for beginners
  • Limited cross-platform support compared to Dart
  • Slower compilation times, especially for large projects

Code Comparison

Swift:

struct Person {
    let name: String
    var age: Int
}

let person = Person(name: "John", age: 30)
print("Name: \(person.name), Age: \(person.age)")

Dart:

class Person {
  final String name;
  int age;
  
  Person(this.name, this.age);
}

void main() {
  var person = Person("John", 30);
  print("Name: ${person.name}, Age: ${person.age}");
}

Both languages support object-oriented programming and have similar syntax for defining classes/structs. Swift uses value types (structs) by default, while Dart uses reference types (classes). Swift's type system is more strict, requiring explicit type declarations, whereas Dart allows for more type inference.

Swift's syntax is generally more concise, but Dart's syntax may be more familiar to developers coming from languages like Java or JavaScript. Both languages offer modern features like null safety and functional programming constructs, but Swift's implementation is often considered more robust and performant.

The official repo for the design of the C# programming language

Pros of csharplang

  • More extensive language specification and design discussions
  • Broader community involvement in language evolution
  • Stronger focus on enterprise-level features and scalability

Cons of csharplang

  • Slower language evolution process due to more complex decision-making
  • Less emphasis on web and mobile development compared to Dart
  • Steeper learning curve for beginners

Code Comparison

csharplang (C#):

async Task<string> FetchDataAsync(string url)
{
    using var client = new HttpClient();
    return await client.GetStringAsync(url);
}

sdk (Dart):

Future<String> fetchData(String url) async {
  final client = HttpClient();
  final response = await client.getUrl(Uri.parse(url));
  return response.close().then((resp) => resp.transform(utf8.decoder).join());
}

The C# example demonstrates async/await with strong typing, while the Dart example shows similar functionality with a more concise syntax. Both languages support asynchronous programming, but C# tends to have more verbose type declarations.

csharplang focuses on language design and specification, while sdk includes the entire Dart SDK implementation. csharplang is more suitable for those interested in language evolution and design decisions, while sdk provides a complete development environment for Dart programmers.

96,644

Empowering everyone to build reliable and efficient software.

Pros of Rust

  • Memory safety without garbage collection, offering better performance and control
  • Powerful type system and ownership model, preventing common programming errors
  • Extensive ecosystem with a package manager (Cargo) and a large community

Cons of Rust

  • Steeper learning curve due to unique concepts like ownership and borrowing
  • Longer compilation times compared to Dart
  • Less suitable for rapid prototyping or scripting tasks

Code Comparison

Rust:

fn main() {
    let numbers = vec![1, 2, 3, 4, 5];
    let sum: i32 = numbers.iter().sum();
    println!("Sum: {}", sum);
}

Dart:

void main() {
  var numbers = [1, 2, 3, 4, 5];
  var sum = numbers.reduce((a, b) => a + b);
  print('Sum: $sum');
}

Both examples demonstrate a simple sum calculation, showcasing syntax differences and language-specific features. Rust's strong typing is evident, while Dart's syntax is more concise. Rust's iterator methods are similar to Dart's, but with explicit type annotations. Dart's string interpolation ($sum) contrasts with Rust's format strings ({}).

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Dart

An approachable, portable, and productive language for high-quality apps on any platform

Dart is:

  • Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.

  • Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.

  • Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.

Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:

  • Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.

  • Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).

Dart platforms illustration

License & patents

Dart is free and open source.

See LICENSE and PATENT_GRANT.

Using Dart

Visit dart.dev to learn more about the language, tools, and to find codelabs.

Browse pub.dev for more packages and libraries contributed by the community and the Dart team.

Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).

Building Dart

If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.

There are more documents in our repo at docs.

Contributing to Dart

The easiest way to contribute to Dart is to file issues.

You can also contribute patches, as described in Contributing.

Roadmap

Future plans for Dart are included in the combined Dart and Flutter roadmap on the Flutter wiki.