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
134
votes
17 answers

Flutter ListView.Builder() in scrollable Column with other widgets

I have a TabBarView() with an amount of different views. I want of them to be a Column with a TextField at top and a ListView.Builder() below, but both widgets should be in the same scrollable area (scrollview). The way I implemented it threw some…
aksn
  • 2,341
  • 4
  • 17
  • 21
134
votes
12 answers

Flutter Navigation pop to index 1

I am recursively adding routes to the navigator. There could be 20 views or more. Pop works as advertised, but I would like to pop to index 1 and remove all push history. is there a way to replace this pop command with something like... …
IrishGringo
  • 3,864
  • 7
  • 37
  • 49
134
votes
19 answers

How do I stretch an image to fit the whole background (100% height x 100% width) in Flutter?

I have an image that doesn't match the aspect ratio of my device's screen. I want to stretch the image so that it fully fills the screen, and I don't want to crop any part of the image. CSS has the concept of percentages, so I could just set height…
Mary
  • 18,347
  • 23
  • 59
  • 76
133
votes
2 answers

How to use RegEx in Dart?

In a Flutter application, I need to check if a string matches a specific RegEx. However, the RegEx I copied from the JavaScript version of the app always returns false in the Flutter app. I verified on regexr that the RegEx is valid, and this very…
Nato Boram
  • 4,083
  • 6
  • 28
  • 58
133
votes
7 answers

Global Variables in Dart

I try to create a Dart single page application. I have created a first custom element (custom-application) which contains the whole application. It has a container in it which is used to render views. And a side nav which will contain user…
T00rk
  • 2,178
  • 3
  • 17
  • 23
132
votes
13 answers

Unhandled Exception: InternalLinkedHashMap' is not a subtype of type 'List

I am trying to get the JSON response from the server and output it to the console. Future login() async { var response = await http.get( Uri.encodeFull("https://etrans.herokuapp.com/test/2"), headers: {"Accept":…
harunB10
  • 4,823
  • 15
  • 63
  • 107
132
votes
25 answers

Flutter Network Image does not fit in Circular Avatar

I am trying to retrieve bunch of images from an api. I want the images to be displayed in Circular form so I am using CircleAvatar Widget, but I keep getting images in square format. Here is a screenshot of images Here is the code I am…
BraveEvidence
  • 53
  • 11
  • 45
  • 119
132
votes
10 answers

Check value in array exists Flutter dart

I am trying to check condition if (value in List) { exist } else { not exist } but nothing to help anyone having an idea then please share. My List = _quantityController[]; itemId is integer i want to check my item id exists in my list array…
Rahul Mishra
  • 4,263
  • 7
  • 32
  • 53
132
votes
9 answers

How to get timezone, Language and County Id in flutter by the location of device in flutter?

I want to get Timezone, language, and county Id when I run my project on my device android or iOS. It should detect Timezone, language and country Id from the location of the device. Can I get these via the internal library?
Ammy Kang
  • 11,283
  • 21
  • 46
  • 68
132
votes
3 answers

Do you need to use the "new" keyword in Dart?

In my Dart based application I just noticed that I can omit the new keyword and everything works perfectly fine. Instead of final widget = new Widget(); I can also use final widget = Widget();. Does this have any effect in code?
creativecreatorormaybenot
  • 114,516
  • 58
  • 291
  • 402
132
votes
5 answers

What are Keys in the Stateless widgets class?

In the flutter docs there's sample code for a stateless widget subclass as shown: class GreenFrog extends StatelessWidget { const GreenFrog({ Key key }) : super(key: key); @override Widget build(BuildContext context) { return new…
DanT29
  • 3,069
  • 4
  • 24
  • 32
132
votes
5 answers

How can I layout widgets based on the size of the parent?

Let's say you have a parent widget that might have a variable size. For example: var container = new Container( height: 200.0, // Imagine this might change width: 200.0, // Imagine this might change // Imagine content in this container will…
Dvdwasibi
  • 10,537
  • 7
  • 22
  • 22
131
votes
17 answers

Error: Member not found: 'packageRoot', how to solve ignore: deprecated_member_use in Flutter?

In my flutter project, I have made some updates of plugins and then used flutter upgrade. After that, whenever I am running my flutter project it is showing following error- …
S. M. Asif
  • 3,437
  • 10
  • 34
  • 58
131
votes
8 answers

The parameter can't have a value of 'null' because of its type in Dart

Dart function I have the following Dart function and I am now using null safety: void calculate({int factor}) { // ... } The analyzer complains that: The parameter 'factor' can't have a value of 'null' because of its type, and no non-null…
creativecreatorormaybenot
  • 114,516
  • 58
  • 291
  • 402
131
votes
14 answers

Flutter Countdown Timer

How can I do to put the value passed in the construction, to make a timer that rounds to the first decimal and shows at the child text of my RaisedButton? I've tried but without luck. I manage to make work the callback function with a simple Timer…
Floris Marpepa
  • 1,891
  • 4
  • 12
  • 22