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
312
votes
16 answers

How to show/hide widgets programmatically in Flutter

In Android, every single View subclass has a setVisibility() method that allows you modify the visibility of a View object There are 3 options of setting the visibility: Visible: Renders the View visible inside the layout Invisible: Hides the View,…
user3217522
  • 5,786
  • 7
  • 26
  • 34
311
votes
13 answers

Flutter: how to make a TextField with HintText but no Underline?

This is what I'm trying to make: In the Flutter docs for Text Fields (https://flutter.io/text-input/) it says you can remove the underline by passing null to the decoration. However, that also gets rid of the hint text. I do not want any underline…
juan park
  • 3,224
  • 2
  • 10
  • 13
308
votes
11 answers

TextField inside of Row causes layout exception: Unable to calculate size

I’m getting a rendering exception that I don’t understand how to fix. I’m attempting to create a column that has 3 rows. Row [Image] Row [TextField ] Row [Buttons] Here is my code to build the container: Container…
Matthew Smith
  • 4,387
  • 3
  • 15
  • 14
304
votes
9 answers

setState() or markNeedsBuild called during build

class MyHome extends StatefulWidget { @override State createState() => new MyHomePage2(); } class MyHomePage2 extends State { List items = new List(); buildlist(String s) { setState(() { print("entered…
Divyang Shah
  • 3,577
  • 5
  • 14
  • 27
303
votes
32 answers

How to create Toast in Flutter

Can I create something similar to Toasts in Flutter? Just a tiny notification window that is not directly in the face of the user and does not lock or fade the view behind it.
Shady Aziza
  • 50,824
  • 20
  • 115
  • 113
301
votes
19 answers

How do I Set Background image in Flutter?

I am trying to set a background image for the home page. I am getting the image place from start of the screen and filling the width but not the height. Am I missing something in my code? Are there image standards for flutter? Do images scale based…
Arun Kumar
  • 3,251
  • 4
  • 14
  • 10
299
votes
10 answers

Flutter- wrapping text

I want wrap text as text grows. I searched through and tried wrap with almost everything but still text stays one line and overflows from the screen. Does anyone know how to achieve this? Any help is highly appreciated! Positioned( left:…
Daibaku
  • 11,416
  • 22
  • 71
  • 108
296
votes
6 answers

How to deal with unwanted widget build?

For various reasons, sometimes the build method of my widgets is called again. I know that it happens because a parent updated. But this causes undesired effects. A typical situation where it causes problems is when using FutureBuilder this…
Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432
293
votes
15 answers

How can I add shadow to the widget in flutter?

How can I add shadow to the widget like in the picture below? This is my current widget code.
Mohammed Mustafa
  • 2,999
  • 2
  • 9
  • 12
292
votes
10 answers

How to run code after some delay in Flutter?

I'd like to execute a function after a certain delay after my Widget is built. What's the idiomatic way of doing this in Flutter? What I'm trying to achieve: I'd like to start with a default FlutterLogo Widget and then change its style property…
Bradley Campbell
  • 9,298
  • 6
  • 37
  • 47
286
votes
28 answers

How do you round a double in Dart to a given degree of precision AFTER the decimal point?

Given a double, I want to round it to a given number of points of precision after the decimal point, similar to PHP's round() function. The closest thing I can find in the Dart docs is double.toStringAsPrecision(), but this is not quite what I need…
Lucas Meadows
  • 2,939
  • 2
  • 14
  • 4
284
votes
7 answers

What is the difference between named and positional parameters in Dart?

Dart supports both named optional parameters and positional optional parameters. What are the differences between the two? Also, how can you tell if an optional parameter was actually specified?
Seth Ladd
  • 112,095
  • 66
  • 196
  • 279
281
votes
16 answers

Multi-line TextField in Flutter

It may sound easy but How can we do a multi-line editable textfield in flutter? TextField works only with a single line. Edit: some precisions because seems like it's not clear. While you can set multiline to virtually wrap the text content, it's…
Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432
278
votes
12 answers

How can I check if a Flutter application is running in debug?

I'm looking for a way to execute code in Flutter when the app is in Debug mode. Is that possible in Flutter? I can't seem to find it anywhere in the documentation. Something like this If(app.inDebugMode) { print("Print only in debug…
Kevin Walter
  • 6,507
  • 8
  • 28
  • 32
278
votes
11 answers

How do I parse a string into a number with Dart?

I would like to parse strings like 1 or 32.23 into integers and doubles. How can I do this with Dart?
Seth Ladd
  • 112,095
  • 66
  • 196
  • 279