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
23
votes
1 answer

How can I extend two classes in flutter?

I am trying to extend two classes having with keyword in flutter to get SearchDelegate override methods but can't do so. Please suggest any solution. class A extends StatefulWidget with SearchDelegate{}
Md. Jahangir Alam
  • 361
  • 1
  • 2
  • 9
23
votes
1 answer

Dart - Circular imports

In other languages (like Python, Go, C#, etc.), circular imports are an issue and the program doesn't run. However, Dart seems to get around this issue and different Dart files can import each other. I am curious about how Dart handles this, and to…
Dinanjanan
  • 399
  • 2
  • 11
23
votes
4 answers

How do I resolve type 'Timestamp' is not a subtype of type 'String' in type cast

I want to fetch meetings from Firestore and map them into the following Meeting model: part 'meeting.g.dart'; @JsonSerializable(explicitToJson: true) class Meeting { String id; DateTime date; Meeting(this.id, this.date); factory…
Reed
  • 1,161
  • 13
  • 25
23
votes
3 answers

How to change CupertinoSwitch size in flutter?

I want to change the size of the CupertinoSwitch in flutter. I have tried putting the switch in Container but changing the size of the container does not affect the switch.
Saheb Singh Tuteja
  • 233
  • 1
  • 2
  • 6
23
votes
3 answers

How to navigate in flutter during widget build?

I'm trying to detect that user is no longer authenticated and redirect user to login. This is how I'm doing it Widget build(BuildContext context) { return FutureBuilder( future: _getData(context), builder: (context, snapshot)…
StackOverflower
  • 5,463
  • 13
  • 58
  • 89
23
votes
2 answers

How can I download file using flutter dio?

I want to downlaod file using url with help of flutter Dio. final imgUrl = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"; var dio = Dio(); RaisedButton.icon( onPressed: (){ …
Jorden
  • 708
  • 3
  • 10
  • 20
23
votes
7 answers

Error: unable to locate asset entry in pubspec.yaml: "assets/fonts/Lato-Regular.ttf"

Before I wrote this, I searched everywhere for my mistake, but I didn't find anything. although I have everything correctly and written down in the pubspec.yaml file, I get this error in the debug console: Launching lib/main.dart on Android SDK…
Tolga
  • 335
  • 2
  • 4
  • 17
23
votes
7 answers

What is the difference between Scaffold and Container in Flutter?

I know both Scaffold and Container are parent widgets in Flutter, but when should I use a Scaffold and when should I use a Container to layout my child widget?
wz366
  • 2,840
  • 6
  • 25
  • 34
23
votes
1 answer

Override gives me an error I cant find the function

Use ; instead of {} for empty constructor bodies.dart(empty_constructor_bodies) A function body must be provided. Try adding a function body.dart(missing_function_body) import 'package:flutter/material.dart'; import './question.dart'; import…
S A Saharukh
  • 378
  • 1
  • 4
  • 11
23
votes
1 answer

How to pass image asset in imageprovider type?

I currently depend on splashscreen 1.2.0 package for the a flutter app. But the backgroundimage variable type is imageprovider, whereas I want to use the image from assets folder. Does anyone know how to pass the image asset file to be able to use…
leemuljadi
  • 410
  • 1
  • 3
  • 14
23
votes
6 answers

Flutter - how to change CheckboxListTile size?

How can I change only the checkbox icon size on a CheckboxListTile? For a Checkbox widget I was able to change its size using Transform.scale, but on the CheckboxListTile I couldn't manipulate the checkbox icon. On a tablet screen the size is too…
Rafael Honda
  • 605
  • 2
  • 5
  • 13
23
votes
3 answers

How can I show greetings like Good Moring, afternoon or evening base on users time in flutter

I want to greet user when they visit my app I have tried using TimeOfDay but it isn't working. TimeOfDay now = TimeOfDay.now(); greetings(String greeting){ var greeting = now; if(greeting <= '11: 59'){ return 'Morning'; } else…
Benkot
  • 265
  • 1
  • 2
  • 6
23
votes
3 answers

Why does the Software Keyboard cause Widget Rebuilds on Open/Close?

I have a screen, which contains a Form with a StreamBuilder. when I load initial data from StreamBuilder, TextFormField show data as expected. When I tap inside the TextFormField, the software keyboard shows up, which causes the widgets to rebuild.…
Roshan
  • 3,236
  • 10
  • 41
  • 63
23
votes
3 answers

How to use BitmapDescriptor.fromAssetImage() to set a custom Marker icon?

I'm trying to set a custom icon for the markers of my map, in my Flutter app. Since BitmapDescriptor.fromAsset() is deprecated, I'm sruggling to find how to use BitmapDescriptor.fromAssetImage(). I did not find any doc or Stackoverflow question…
Mickaël D
  • 447
  • 1
  • 4
  • 14
23
votes
5 answers

Flutter: Send JSON body for Http GET request

I need to make a GET request to an API from my Flutter app which requires request body as JSON (raw). I tested the API with JSON request body in Postman and it seems to be working fine. Now on my Flutter application I am trying to do the same…
codeinprogress
  • 3,193
  • 7
  • 43
  • 69