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
3 answers

How to create nullable variable in Dart

I created a model class, this is one of my a variable in model class Datetime hotel_effect_open_date but JSON response hotel_effect_open_date is null, getting an error in my application. and I modified to DateTime to String, it's working. In API…
user11065582
23
votes
3 answers

PageView.builder giving Horizontal viewport was given unbounded height error

I'm very new to flutter and I'm trying to learn how to create views. I tried to create a separate file of the view, or widget if that's what it's called in flutter, and just call it from the main.dart. I have a separate widget containing this…
Rick
  • 2,003
  • 4
  • 16
  • 28
23
votes
2 answers

how to stringify json in flutter

In flutter(dart), it is easy to deserialize Json and get a token from it, but when I try to serialize it again, the quotation marks around the keys and values with disappear. String myJSON = '{"name":{"first":"foo","last":"bar"}, "age":31,…
Mehdi Khademloo
  • 2,754
  • 2
  • 20
  • 40
23
votes
5 answers

How to use my dart packages private and not show on pub dart lang?

I have dart packages that I don't want to publish to pub because of my company agreement. How to use my dart packages for only my company and not show on pub dart lang? I've looked up on this link https://github.com/dart-lang/pub/issues/1050 but…
nhuluseda
  • 637
  • 3
  • 8
  • 19
23
votes
3 answers

Flutter console log "Failed to send request: {"jsonrpc":"2.0","id":"9354","method":"getVM","params":{}}"

I have some strange thing happening on my Android studio dart console : every second there is this message : Failed to send request: {"jsonrpc":"2.0","id":"9354","method":"getVM","params":{}} The "id" count keeps incrementing and i can't find a…
julient-monisnap
  • 774
  • 2
  • 8
  • 25
23
votes
2 answers

Flutter listening to textField value changes from other widget

Below is a dialog to capture users input by using a textField and a button. The button is disabled when textField is empty, however it continues to become disabled when textField is filled with values. This is because the _textController.text state…
Jesse
  • 2,690
  • 9
  • 15
  • 28
23
votes
5 answers

How to clear app cache programmatically on Flutter

As I have been developing app using Flutter. I came to find that app is heavy in size plus it is using a lot of space as app data and app cache. Is there any way to clear app cache programmatically? Edit: my app's size in release mode is about 7mb…
DoeJ
  • 405
  • 1
  • 4
  • 14
23
votes
3 answers

How to convert ascii value in integer to its character equivalent in flutter?

I am new to flutter and I just want to display a list of alphabets in a for loop. I just want to know how can I convert the integer to ascii character. I searched for this and I found dart:convert library, but I don't know how to use it. I want…
Keshav
  • 901
  • 4
  • 10
  • 16
23
votes
3 answers

How to subscribe to a topic in flutter FCM?

I'm a new one in a flutter and in my app, I need to implement FCM with global or with a topic subscription. I successfully implemented the FCM with device token but need to send a notification to all device. how can we fix this?
Ajnas Askar
  • 925
  • 3
  • 8
  • 12
23
votes
2 answers

error: Target of URI doesn't exist: 'package:test/test.dart'

Since the latest flutter update my tests are broken. It looks like the Dart test framework isn't available anymore: error: Target of URI doesn't exist: 'package:test/test.dart'.
Soundbytes
  • 1,149
  • 9
  • 17
23
votes
5 answers

How to add Polyline on Google Maps Flutter Plugin?

I'm using the official Google Maps Flutter plugin to show maps and it works perfectly well but now I want to show a route in the map so I'm using this package to provide me the route I only need to add the Polylines.
braulio.cassule
  • 1,322
  • 4
  • 14
  • 23
23
votes
2 answers

How can I tell if a string can be json.decode

My cache class import 'dart:async'; import 'dart:convert'; import 'package:shared_preferences/shared_preferences.dart'; class CacheUtil{ static set(String key, value) async{ if(value is Map || value is List){ value =…
sunmoon
  • 355
  • 1
  • 4
  • 8
23
votes
2 answers

How to use 2 mixins in State in Flutter?

I have a state class class ListScreenState extends State... And I want to use AutomaticKeepAliveClientMixin (to prevent the TabBar that holds these screens from disposing of) and TickerProviderStateMixin because I have the animation…
Dmitry Volkov
  • 500
  • 1
  • 3
  • 14
23
votes
2 answers

Flutter- compute method

I'm trying to execute heavy method by compute(). I tried like so. After loop executed, Text widget update but result returns 0 almost right after button was pressed. Does anyone know what am I missing? int _counter; static int loop(int val) { …
Daibaku
  • 11,416
  • 22
  • 71
  • 108
23
votes
3 answers

Flutter - How to parsed nested json to a class with generics?

I'm wondering how can I parse a nested json to a class with generic types. My intention is to wrap responses from the backend (like loginRespose that contains a token) with a code and a message I have class BaseResponse{ int code; String…
Sebastian
  • 3,666
  • 2
  • 19
  • 32
1 2 3
99
100