Most voted "dart" questions
Dart is a web-based language developed by Google. The goal of the Dart language is to replace Javascript as the main language of browsers. Programs in this language can be either run on a virtual machine or compiled for Javascript.
Learn more…410 questions
Sort by count of
-
16
votes1
answer1733
viewsWhat are the main differences between Dart and Typescript?
We already had a question comparing two languages that run on top of Javascript. I think it was necessary to compare two languages created for the purpose of creating applications for browsers and…
-
7
votes2
answers102
viewsDo partial imports bring advantages to the application?
Some languages have as a resource the import of parts of the library used. Using Dart as an example we have two types of partial Imports showand hide . import 'package:google_maps/google_maps.dart'…
-
5
votes1
answer550
viewsHow do I validate an email field on Dart?
I created a simple project in Dart whose intention is to validate an e-mail field when a button is clicked, showing an error message. However, the function Regexp.hasMath is always returning false.…
-
5
votes2
answers389
viewsWhat is the function of the keys { } in this interpolation?
class MyStateFull extends StatefulWidget{ MyStateFull(this.nome); final String nome = 'Maria'; @override _ContadorClique createState() => _ContadorClique(); // @override //…
-
5
votes1
answer752
viewsWhat’s the difference between "Future.whenComplete" and "Future.then"?
The Dart language provides several mechanisms for handling asynchronous calls. One I’m very used to is modifying await, which can be used in functions marked as async. However, we are sometimes in a…
-
5
votes1
answer351
viewsSecondary thread on flutter
Hello, I have the following problem in flutter: I currently have an application with the plugin flutter_background_geolocation based on the example that is provided by the plugin. While performing…
-
4
votes1
answer73
viewsHow do for the child widget of a Column expands to the maximum width of the parent(Column)?
Form( child: Column( children: <Widget>[ CustomTextFormField("E-mail"), CustomTextFormField('Senha'), Expanded( child: FittedBox( fit: BoxFit.fitWidth, child: RaisedButton( onPressed: () {},…
-
4
votes2
answers7739
viewsFlutter - Change internationalization of date names
I am new to Flutter and I would like to know if it is possible to automatically translate the names of the days of the week, months, etc ... encompassing every application?
-
4
votes1
answer805
viewsHow can the use of 'const' constructors improve performance in Flutter?
In the documentation one of the recommendations to improve the performance of applications in Flutter says: Use constant widgets whenever possible and provide a const constructor... How to…
-
4
votes2
answers529
viewsFlutter - How to pass Firestore ID list to a Futurebuilder?
I’m developing a book app and need help uploading the user’s favorite book list. I don’t know the way I’m doing it would be the right one, I’m saving the Ids of all the books that the favorite user…
-
4
votes3
answers3057
viewsCurrent location - Flutter
Guys, I need to get the current latitude and longitude of the cell phone coom flutter, but it’s not working and I’m not finding anything on the internet, someone can help me? code: import…
-
4
votes2
answers197
viewsWhen to use Factory in abstract classes?
Abstract classes are classes that cannot be instantiated and their implementation depends on other classes, but using the keyword Factory can "instantiate" an abstract class. So, how and when to use…
-
4
votes1
answer71
viewsIn pubspec.lock, what is a "direct main" dependency?
In Dart, we specify dependencies through pubspec.yaml through indicators of the desired version (similar to gemfile for Ruby or the composer.json for PHP). From this list of dependencies and…
-
4
votes2
answers290
viewsHow to search whether a string array contains in another string array. Using complete and incomplete words
How to search in an array of strings using complete and incomplete orders, similar to what the phonebook does. Example: List array1 = ['Escola','Estadual','José','da','silva']; Lista busca =…
-
4
votes1
answer95
viewsValidation test works with numerical values but not strings
My inheritance code works normal, what I wanted to do is if the nome and the pseudonimo are null the code would stop, the code only stops running when idade, altura or peso sane null. import…
-
3
votes3
answers3112
viewsHow to change the border color of a Textformfield?
I would like to change the color of the Textformfield border on the login screen to white, because the background is gradient and it would be easier to view the text. Today I’m using the pattern I…
-
3
votes1
answer567
viewsParameterize functions to receive functions
What are the advantages of parameterizing Dart functions? void main() { metodoSemFuncao(); metodoComFuncao(funcao); } void metodoSemFuncao(){ funcao(); } void metodoComFuncao(Function func){ func();…
-
3
votes3
answers2619
viewsVscode + GIT + Flutter Configuration
Sirs, I am starting the studies in Flutter, I did the installation of Flutter, Dart, GIT and Vscode, when I will start the development Vscode returns me the following error: [undefined] flutter…
-
3
votes2
answers546
viewsDifference between ways to import with and without 'package:'
When we import a class/library two options are suggested, I wonder if there is any difference/advantage between importing classes/libs directly informing the path and with the 'command' package: Ex:…
-
3
votes1
answer722
viewsSetstate Flutter
Good afternoon. I’m starting with flutter (I came from Reactnative), watching some courses... and I got the question: What does setState really control? In Reactnative he looks at everything we set…
-
3
votes1
answer819
viewsHow to get the uid of the currentUser in the firebase in flutter?
After the splashscreen I check if the currentUser is null. If it’s not I redirect it to my home. The problem is that this user’s UID is null. I wonder how do I get this UID from currentUser. I used…
-
3
votes1
answer95
viewsWhy does "var" force type inference?
Performing some tests with the language I noticed that when we use the keyword var Dart will "force" the type inference, but when we use a type to declare variables this does not happen. The test I…
-
3
votes1
answer326
viewsBest Practices for Creating Widgets
I know two ways to create widgets, extending StatelessWidget class MeuWidget extends StatelessWidget { const MeuWidget({Key key}) : super(key: key); @override Widget build(BuildContext context) {…
-
3
votes1
answer1163
viewsNavigation with named routes
I am trying to create some routes named in flutter. When clicking on a floating button, I should direct myself to a screen called new_flight.Dart however, I am seeing an exception: I/flutter (…
-
3
votes0
answers388
viewsNon-nullable instance field '_Description' must be initialized
"Non-nullable instance field '_Description' must be initialized." As of version 2.12.0, Flutter always displays messages like this, how to solve this problem without downloading the version?…
-
3
votes2
answers244
viewsWhich package should the "@required" annotation be imported from?
I need to put the note @required in a builder: class Pacote { final int id; final int nCodigos; final String tabela; Pacote({@required this.id, @required this.nCodigos, @required this.tabela}); //…
-
3
votes1
answer1251
viewsHow to use the Assert statement?
To Documenting informs that: During development, use a statement assert for interrupt normal execution if a condition is false. The instruction assert ensures, for example, the manipulation of…
-
2
votes1
answer5735
viewsHow to use ternary operator in Flutter/Dart
How to do the if/else in a row on Dart/Flutter? Type: variavel ? null : function() : function2()
-
2
votes1
answer168
viewsFlutter - Bottomnavigationbar more than three blank items
When I add more than 3 items to the component (Bottomnavigationbar), this leaves my items blank.…
dartasked 6 years, 5 months ago Cristiano Sommer 31 -
2
votes1
answer1197
viewsHow to understand this structure?
ContactHelper.internal(); static final ContactHelper _instance = ContactHelper.internal(); factory ContactHelper() => _instance; After an intense research on Factory methods and Singleton…
-
2
votes1
answer96
viewsHow to add Dart syntactic highlight to VIM?
I am starting the studies of Flutter. For this, I am using as editor the vim. I consider it an option to use an IDE, but for quick and small things, use the vim is mandatory for how I am studying.…
-
2
votes2
answers815
viewsDo you have a plugin for VS Code that shows the color on the side?
I am programming in Dart/ Flutter and would like to find a plugin that does the same as Android Studio, recognizing the color typed and showing on the side The written colors are a little different…
-
2
votes1
answer2045
viewsHow can I resolve error "The argument type 'String' can’t be Assigned to the Parameter type 'List<int>' " - Flutter
I’m trying to fetch an API Token using Flutter, but this code: var _random = Random.secure(); var random = List<int>.generate(32, (i) => _random.nextInt(256)); var verificador =…
-
2
votes2
answers1192
viewsHow to open the link by clicking on a Gridview image and placing the name below it?
Good morning! I’m starting to learn programming with flutter, I’m very new in the field. I want to know how to open the link of a site, when clicked on a certain image that is in the flutter…
-
2
votes1
answer110
viewsFill items from a Dropdownbutton with a Json value
I have a field DropDownMenu and would like to fill in the Items of it with the values of my Json. I have this code: String _mySelection; List<Map> _myJson =…
-
2
votes0
answers76
viewsHow to use Sqlite in CLI applications written in Dart?
I’m testing the Dart to discuss its feasibility in replacing part of the code base in Java. I didn’t find anything similar to the JDBC specification in Dart, so I’m guessing the language doesn’t…
-
2
votes1
answer239
viewsLogin with google does not work in apk release Flutter
In debug mode, login works normally, I’ve already configured SHA1 and also added Internet permission, in debug mode it works normally, but when I Gero the final apk, it doesn’t work (opens the panel…
-
2
votes1
answer141
viewsWhat are the differences between the implementations of the Set class on Dart?
The documentation says that Set is A collection of objects in which each object can occur only once. In the documentation of this class there is a small summary of the different classes that…
dartasked 5 years, 3 months ago rubStackOverflow 7,372 -
2
votes1
answer482
viewsTaking specific data from a "(Response.body)"
I have that code: class _EstabelecimentosPageState extends State<EstabelecimentosPage> { final String url = codeUrl; @override void initState() { super.initState(); this.getJsonData(); }…
-
2
votes1
answer193
viewsWhat’s the difference between Dynamic and Object
What’s the difference between using Dynamic and Object on Dart? For example, functions that do not know the type of return: Future<dynamic> getQuery ou Future<Object> getQuery To make…
-
2
votes1
answer2254
viewsFlutter - How to perform a search in a listview?
Hello! I found many tutorials on the internet, but I could not implement any successfully. Most of these tutorials, work with the creation of 2 lists, an initial and a secondary to be manipulated.…
-
2
votes1
answer455
viewsFlutter does not return images from api
I’m trying to get the images from mongodb database, via api I did in nodejs, but it doesn’t work at all, and still presents this error here. Invalid argument(s): No host specified in URI…
-
2
votes2
answers785
views -
2
votes1
answer101
viewsHow to enable Null-Safety on Flutter without breaking the project?
How to enable Null-Safety in Flutter without running the risk of breaking the project? I saw many reports of people that when enabling appear compatibility problems in certain libraries.…
-
2
votes1
answer143
viewsError while running Dart list
I am trying to make a list in Dart/flutter, however I am getting the following error while running the app screen. Repository class: chamarGetGaiola(String usuario, String token) async {…
-
2
votes0
answers37
viewsBottomexpandableappbar Fluttter how to make it work
Guys good night, I’m having problem that I can not solve, I’m trying to add an expansive menu bar at the bottom of the screen and is not appearing when I run the code import 'dart:async'; import…
-
2
votes1
answer595
viewsTouch effect (touch ripples) on long touches, with Inkwell
We can create a button with a Container, so leave it as we wish. My doubt, is in the touch effect with the InkWell, that a color is added to the Container, the same "stops working" as in the…
-
2
votes2
answers1700
viewsHow to prevent the user from returning to the login screen after logging into the flutter?
I have the following login widget that after the request is successfully made, it adds on the navigation stack to the home screen and removes the login screen. If I try to get back from home screen…
-
2
votes2
answers236
viewsHow to change the language of the Flutter Image Picker plugin?
I would like to change the language of the text that is displayed in the library image_picker, i would like to leave this text translated into the user’s mobile language. If the image of how it is…
-
2
votes2
answers221
viewsStatelesswidget Only State Management (no Statefulwidget or external libs)
Is there any way of a StatelessWidget have or simulate a state control? To not be without context, let’s take as a basis the standard example of flutter: import 'package:flutter/material.dart'; void…