Questions tagged [dart]

Dart is a class-based, statically(& strongly)-typed programming language for building web and mobile applications. Dart compiles to modern JavaScript to run in the browser and compiles to native code to run on mobile platforms like Android and iOS. Dart also runs on the command-line for scripting and server-side apps.

Dart is an open-source, class-based, statically(& strongly)-typed (with inference) programming language for building web and mobile applications created by Google. Although Dart is statically-typed it supports dynamic-typing through the 'dynamic' type.

Dart’s design goals are:

  • Create a structured yet flexible language.
  • Make Dart feel familiar and natural to programmers and thus easy to learn.
  • Ensure that Dart delivers high performance on modern web browsers, mobile, and environments ranging from small handheld devices to server-side execution.

Dart targets a wide range of development scenarios, from a one-person project without much structure to a large-scale project needing formal types in the code to state programmer intent.

To support this wide range of projects, Dart provides the following features and tools:

  • Sound type system: A type system which feels lightweight thanks to inference and gives good safety
  • Mobile and Web frameworks: Dart developers can use Flutter on mobile and AngularDart on the web
  • IDE Integration: official plugins for Jetbrains' IDEs (IntelliJ IDEA / WebStorm etc) and Visual Studio Code. Community plugins also exist for many other editors backed by the Dart Analysis Server

Links

Documentation

FAQ

Chat Room

90488 questions
24
votes
3 answers

How do I pan and zoom an image?

I'm trying to get some basic pan and zoom functionality for images. The stateless version can display images (rotated 180 degrees by Transform) and the Scale events show up in the logs, but that's it. Is GestureDetector the correct widget for…
perlatus
  • 531
  • 2
  • 6
  • 12
24
votes
5 answers

Dart: how to manage concurrency in async function

I really like the async/await pattern in Dart. It allows me to write readable methods. But, there are a couple of things that are problematic, one in particular, I don't know hot to manage at all. The problem is that with async and multiple await…
J F
  • 1,058
  • 2
  • 10
  • 21
24
votes
4 answers

Is there an easy way to find particular text built from RichText in a Flutter test?

For example, I may have one RichText in current widget tree, that looks like RichText( text: TextSpan( text: 'Hello ', style: DefaultTextStyle.of(context).style, children: [ TextSpan(text: 'bold', style:…
Wei Song
  • 1,517
  • 3
  • 11
  • 9
24
votes
2 answers

Is it possible to register a Flutter app as an Android Intent Filter and to handle Incoming Intents?

One can launch another Activity using an Intent from a Flutter app: https://github.com/flutter/flutter/blob/master/examples/widgets/launch_url.dart import 'package:flutter/widgets.dart'; import 'package:flutter/services.dart'; void main() { …
Pieter Greyling
  • 341
  • 1
  • 2
  • 5
24
votes
1 answer

Is there an int.INFINITY for Dart?

I see there is a double.INFINITY but I can't see a way to say "int INFINITY". Which is interesting, because I see I can do some_integer.isInfinite. What's a way to say int.INFINITY in Dart? Does that even make sense?
Seth Ladd
  • 112,095
  • 66
  • 196
  • 279
24
votes
6 answers

Dart how to add commas to a string number

I'm trying to adapt this: Insert commas into number string to work in dart, but no luck. either one of these don't work: print("1000200".replaceAllMapped(new RegExp(r'/(\d)(?=(\d{3})+$)'), (match m) => "${m},")); print("1000300".replaceAll(new…
Alex L.
  • 416
  • 1
  • 4
  • 14
24
votes
3 answers

How do I get query parameters in the URL

In Dart I am working on a web game. In this I would need a function where I can get data from the URL, in the same way that you would get it in PHP. How would I do this? Say I, for example, append the following to my URL when I load my web game:…
Casper Bang
  • 793
  • 2
  • 6
  • 24
24
votes
9 answers

How to convert DateTime into different timezones?

How to convert DateTime into different timezones? The DateTime class has two methods .toLocal() and .toUtc(). But if I want to display time in another time zone. How can I do it?
Sergey
  • 425
  • 1
  • 4
  • 11
24
votes
1 answer

How to redirect and reload the right way in Dart?

What are the preferred ways to do a redirection and a reload in Dart? Do we just use: window.location.href = window.location.href?
Tower
  • 98,741
  • 129
  • 357
  • 507
24
votes
2 answers

How do i know if connection is alive with websockets?

I have a webapp, which is running in a browser. That webapp is connected to a server, which uses websockets. So the communication between the server and my client/browser is based on websockets. If some magic event occurs on the server, some…
Gero
  • 12,993
  • 25
  • 65
  • 106
24
votes
5 answers

AngularJS style programming in Dart?

Does anybody know a library or project that allows for an AngularJS style of programming in Dart? I'd like to be able to create annotated HTML files for declaring my UI instead of imperatively instantiating everything like in SWT. Also, features…
vsp
  • 919
  • 7
  • 14
23
votes
5 answers

fatal: couldn't find remote ref refs/heads/master

I am trying to install Homebrew. However, the following error happened. fatal: couldn't find remote ref refs/heads/master Error: Fetching /opt/homebrew/Library/Taps/dart-lang/homebrew-dart failed! Error: Some taps failed to update! The following…
user21251016
  • 231
  • 1
  • 3
23
votes
1 answer

Optimizations of "+" operand for strings in JDK 17

We know that in JDK8 and below, strings using a plus sign for concatenation will be compiled into StringBuilder for performance optimization, but after JDK9, it will be implemented using the…
Hyrio
  • 231
  • 3
23
votes
7 answers

Flutter Error: No named parameter with the name 'displayLarge'

I am working on an app, I posted last update on git 2 days ago and haven't touched the code since. Now, I opened android studio and it was giving me this error when I tried to run it... I tried deleting repository from my computer and then cloning…
23
votes
5 answers

Equivalent of if let and guard let of Swift in Dart

Just started Flutter with native iOS background, so I just have a quick question about Dart beta null safety. So in Swift, because they have the idea of null safety from the beginning just like Kotlin, there are 2 features that I really like about…
Son Nguyen
  • 1,124
  • 2
  • 10
  • 24