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
167
votes
34 answers

Enum from String

I have an Enum and a function to create it from a String because i couldn't find a built in way to do it enum Visibility{VISIBLE,COLLAPSED,HIDDEN} Visibility visibilityFromString(String value){ return Visibility.values.firstWhere((e)=> …
FPGA
  • 3,525
  • 10
  • 44
  • 73
167
votes
18 answers

Clone a List, Map or Set in Dart

Coming from a Java background: what is the recommended way to "clone" a Dart List, Map and Set?
Patrice Chalin
  • 15,440
  • 7
  • 33
  • 44
164
votes
13 answers

How do you change the value inside of a textfield flutter?

I have a TextEditingController where if a user clicks a button it fills in with information. I can't seem to figure out how to change the text inside of a Textfield or TextFormField. Is there a solution?
Daniel
  • 2,223
  • 3
  • 9
  • 18
161
votes
12 answers

What's the best practice to keep all the constants in Flutter?

What's the best programming practice to create a constant class in Flutter to keep all the application constants for easy reference? I know that there is const keyword in Dart for creating constant fields, but is it okay to use static along with…
Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77
161
votes
16 answers

How to add clear button to TextField Widget

Is there a proper way to add a clear button to the TextField? Just like this picture from Material design guidelines: What I found is to set a clear IconButton in the InputDecoration's suffixIcon. Is this the right way?
xiaoyu
  • 2,369
  • 2
  • 13
  • 15
160
votes
13 answers

How to remove scroll glow?

By default, flutter adds a glowing effect on ListView/GridView/... to overscrolls on android phones I would like to remove this effect entirely or on one specific scrollable. I know that I can change ScrollPhysics to change between Bounce/Clamp. But…
Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432
159
votes
12 answers

Flutter SVG rendering

I tried adding an image with a SVG source to my flutter application. new AssetImage("assets/images/candle.svg")) But I didn't get any visual feedback. How can I render an SVG picture in Flutter?
Arash
  • 11,697
  • 14
  • 54
  • 81
158
votes
11 answers

How to shift focus to the next TextField in Flutter?

I am new to Flutter. I am building a form with multiple text inputs using following widgets: Form, TextFormField. The keyboard that appears doesn't show "next" (which should shift the focus to next field) field action instead it is "done" action…
Harsh Bhikadia
  • 10,095
  • 9
  • 49
  • 70
158
votes
11 answers

Not able to change TextField Border Color

I am trying to change color of the border of my TextField using a BorderSide, but it does not work. This is my code below. new TextField( decoration: new InputDecoration( border: new OutlineInputBorder( borderSide: new BorderSide(color:…
Smruti Ranjan Rana
  • 1,964
  • 2
  • 12
  • 15
158
votes
12 answers

Create a list from 0 to N

How can I create easily a range of consecutive integers in dart? For example: // throws a syntax error :) var list = [1..10];
Cequiel
  • 3,505
  • 6
  • 27
  • 44
157
votes
8 answers

How to add a package from GitHub in Flutter?

I need to use the latest source code of a package and the latest source hasn't been published yet. What should I write into pubspec.yaml to get a package in Github? The code below doesn't work. It doesn't download the package and I can't import it…
Kostya Vyrodov
  • 6,257
  • 5
  • 23
  • 34
156
votes
18 answers

Flutter: Unimplemented handling of missing static target

I am running my first Flutter project I created a sample project and I was able to run the app in simulator I have edited the file main.dart main.dart import 'package:flutter/material.dart'; void main() => runApp(MaterialApp(home: Text('Hello…
Devrath
  • 42,072
  • 54
  • 195
  • 297
155
votes
6 answers

Dart: mapping a list (list.map)

I have a list of Strings, e.g., var moviesTitles = ['Inception', 'Heat', 'Spider Man']; and wanted to use moviesTitles.map to convert them to a list of Tab Widgets in Flutter.
155
votes
12 answers

What is the relation between stateful and stateless widgets in Flutter?

A stateful widget is defined as any widget which changes its state within its lifetime. But it is a very common practice for a StatelessWidget to have a StatefulWidget as one of its children. Doesn't StatelessWidget become stateful if it has…
user462455
  • 12,838
  • 18
  • 65
  • 96
154
votes
7 answers

How to check the installed version of Flutter?

How do I find the version of Flutter I have installed on my computer?
user8637708
  • 3,303
  • 2
  • 13
  • 15