Collect all kinds of dart programming exceptions and fault solutions.


How to generate random string in dart?

I want to create a function that generates a random string in dart.
It should include alphabets and numbers all mixed together. How can I do that?


How to compare same object instance in Dart?

I'm making an http call that will either return a 200, 412 or 403 statusCode. If it returns an error code, I'll throw an exception
if(response.statusCode == 412){
throw InvalidCredentialsExceptio...


Expected a value of type 'List<int>', but got one of type 'WhereIterable<int>'

List<int> filterEvens(List<int> ints) {
var foo = ints.where((n) => n.isEven) as List<int>;
var bar = ints.where((n) => n.isEven).toList();
return foo; // Runtime err...


How to make deep copy on list of maps in dart?

How can i make deep copy on List of Maps in dart ? . Here is the code i have tried :
void main() {
List<Map> arr1 = [
{'f1': 1, 'f2': 2}
];
List<Map> arr2 = [...arr1];
arr2...


How to modify a functions internal variables at runtime and pass it to another function?

Functions in Dart are first-class objects, allowing you to pass them to other objects or functions.
void main() {

var shout = (msg) => ' ${msg.toUpperCase()} ';

print(shout("yo&q...


What's the difference between ? and ! in a Collection?

What's the difference between ? and ! when used in a collection in Dart?
Say, I have:
var list = [1, 2];
Now, I can either use
print(list?[0]); // prints 1
or
print(list![0]); // also prints 1
...


What do curly braces wrapping constructor arguments represent?

Consider the following piece of code:
class Person {
String id;
String name;
ConnectionFactory connectionFactory;
// What is this constructor doing?
Person({this.connectionFactory:


Flutter NotificationListener with ScrollNotification vs ScrollController

There are two options to retrieve the scroll position for a CustomScrollView. The documentation states the following:
ScrollNotification and NotificationListener, which can be used to watch the


How to make flutter app responsive according to different screen size?

I am facing difficulties to make it to responsive according to various screen sizes. How to make it responsive?
@override
Widget build(BuildContext context) {
return new Container(
...


Close modal bottom sheet programmatically in flutter

I am displaying a BottomSheet via showModalBottomSheet<Null>() and inside several widgets with a GestureDetector.
I would like to see the BottomSheet closed not only by touching outside it bu...


Transparent sticky footer in Flutter

I was following this Stack Overflow post for making a sticky footer. The footer performs like it needs to, but is there a way to add transparency so the items in the list behind the footer can be v...


Understanding the Dart Flutter framework

I am new to Flutter and Dart too. I need your help in understanding:
variables such as child:, body:, home:, etc? Are they properties or labels? And how are they accessed by the framework?
the use...


Flutter TextField with currency format

There's is some way to do a money format in a TextField to when the user going typing the value it going already formatting in real time?
Like in the above image, while the user is typing the format


How to pass object or List of object in Fluro route navigator

I have used Fluro package inside of my Flutter app and I implemented all of my routes with handler like the example of this package.
Could you please let me know what is the correct way to pass an


A problem in using ClipRRect() in Flutter

I have used ClipRRect for rounded corners in the UI. The ClipRRect wraps topContent and bottomContent are a stack and a Column respectively. But, the bottom corners are not round. What may be the r...


How to change shadow color of AppBar?

I am trying to change shadow elevation color of the AppBar but can't find any property for that.
I went to the original implementation as well but cant find any property to change shadow color.
Ap...


How to avoid [] called on null in Flutter

Is there is a method in dart to judge whether an object is null or not, and then decide to get ['data'] or do nothing?
This is the error message:
The following NoSuchMethodError was thrown bui...


Error thrown on navigator pop until : "!_debugLocked': is not true."

When popping a screen navigating to other one by clicking on the showBottomSheet, this error is thrown through the following code . I cant get why this is occurring.
class _CheckoutButtonState ext...


How to write a map to a YAML file in Dart

I have a map of key value pairs in Dart. I want to convert it to YAML and write into a file.
I tried using YAML package from dart library but it only provides methods to load YAML data from a file.


Dart named constructor, static method, and factory constructor

Given the following code:
const jsonString = '{"myString":"Hello"}';
final jsonMap = jsonDecode(jsonString);
final myObject = MyClass.fromJson(jsonMap);
How many ways are ther...


How to handle browser history using History class

So I'm learning dart and web development in general. Right now I'm experimenting with the history API. I have:
import 'dart:html';
void main() {
ParagraphElement paragraph = querySelector('.par...


Dart Package Management via dart2js

I'm learning Dart and its dependency manager pub and am having a tough time seeing the "forest through the trees" here.
Say I want to use Polymer.dart in my project. So, in my project root, I crea...


Get index in dart polymer repeat template

I want to iterate over an enumerable and display a counter
<div template repeat="{{ name in names }}">
###. {{name}}
</div>
What should I put instead of ### so it shows the position...


Is it possible to declaratively bind a CustomEvent handler when using Dart Web UI WebComponents?

I've tried to bind a custom event handler to a WebComponent that has an EventStreamProvider exposed via a getter, but it comes back with "Class 'DivElement' has no instance getter 'onMainAction'.".


Dart project with more than one main HTML file

I'm using Dart to build some functionality for an intranet site, and I'm wondering what the best way to organize a project with two "pages" in it is. Questions like this one, suggest that the (onl...


What does "context" of "Widget build(BuildContext context)" mean in Flutter?

TL;DR:
Is it the second parameter of build method or, name declaration of the BuildContext parameter in a conventional way?
I'm learning the basic syntax of build method in Flutter by breaking dow...


Flutter Listview Scrollable Row

new ListView(
children: [
new SizedBox(
height: 100.0,
child: ListView(
...


dart web component don't refresh a List on UI

I'm trying to create a simple web component which purpose is to display messages for some seconds and then dissapear. I've got displayed the first two Strings but when I call the informar method no...


How to find an HTML element inside a Polymer template

I'm using Dart and Polymer 1.0.0-rc.9. I have my own element (simplified here of course):
<dom-module id="something">
<style>
</style>
<template>
<paper-slider id='


In dart web projects, shouldn't type and reference warnings be errors?

In dart, when developing a web application, if I invoke a method with a wrong number of arguments, the editor shows a warning message, the javascript compilation however runs successfully, and an e...


Is dart:intl broken? / DateFormat to complicated

I using Dart Editor 0.3.7_r18717 (means the editor is up to date (Feb 2013)
import 'dart:intl';
Shows an error "Cannot find referenced source"
If I import the package via pub
import 'package:intl/


Compiling Web UI components to the HTML

I'm building a simple web site in Dart Web UI. Each page has a header (with site navigation) and a footer. I've used components for the header and footer, and each page looks something like this:
...


How to structure a Dart application with multiple views with Polymer

This question has been asked before but since the answer to that question Dart has adopted polymer to replace Web UI. Is there a Polymer version of the answer to this question? Also, I saw the an...


Dynamically create polymer element

I have defined login element as follows:
<polymer-element name="my-login" extends="form">
<template> ...</template>
and dart class as follows:
@CustomTag('my-login')
class


Making a Map or a List observable in Web UI

I can make a String or a num type observable by using the @observable declaration in the Dart code:
@observable
var x = '';
and {{ }} syntax in the html:
<div>x = {{x}}</div>
But @


Dart bind JsonObject error: type 'List<dynamic>' is not a subtype of type 'JsonObject' of 'value'

I have a main GLTkComponent
============= xgltk.dart GLTkComponent.dart ==================================
@observable
class GLTkComponent extends WebComponent {
ObservableList<JsonObject>


Flutter: Tabbar vs BottomNavigationBar

I'm trying to figure out the best way for bottom navigation with swipe enabled. I found two promising widgets: Tabbar (with TabBarView) and BottomNavigationBar. The tabbar is easy to use and has a


Polymer Dart - Multiple View

I'm trying to create a sample CRUD application using Dart and Polymers.
One think I noticed is almost all dart polymer examples have only one page. I'm trying to look for samples with multiple pa...


Using Futures to load config.json in Flutter

Being new to Dart/Flutter I am using this snippet to try and load a config.json file that I have stored in my assets folder. In trying to read this file, I am using models on the Dart language Futu...


Testing Web Apps Using DRT

I'm trying to use DRT for running acceptance tests.
Because it's an acceptance test I need to change the location to open the page under test. But of course, after I've done it my test script is ...


Which files needs to be deployed from a Dart project?

I have an AngularJS project that I am thinking of migrating to Dart. I do not want to migrate the whole project in a big-bang, so I am looking for ways to run the two apps side-by-side.
The dart ...


DartEditor M4 pub functions is broken

Just updated to DartEditor M4 and somehow 'Pub' related functions just stop working :( :(
Dart Editor version 0.4.7_r21548
Dart SDK version 0.4.7.1_r21548
Linux alex 3.5.0-27-generic #46-Ubuntu SMP...


Flutter bottom navigation where one page has tabs

I would like to create A scaffold with bottom navigation bar, and an app bar which always displays current page title. When I change bottom bar option, the content changes obviously. Everything thi...


Set the dart-editor server responses

My apache server is setup to respond to any request with the index.html. The idea behind this is to let the web app we are creating handle the routing. The dart-editor test environment does not do ...


How to work with char types in Dart? (Print alphabet)

I am trying to learn the Dart language, by transposing the exercices given by my school for C programming.
The very first exercice in our C pool is to write a function print_alphabet() that prints...


How do you convert a list future to a list to use as a variable not a widget?

I'm trying to implement the PaginatedDataTable class in flutter. A required field in the constructor of this class, is the class DataTableSource. Looking at the data table example in the material s...


Error vs. Exception in Dart

Why are there Errors AND Exceptions in Dart and not either Errors OR Exceptions?
Is the reason a historical one oder what?
I can throw an Error, I can throw an Exception. None of them is checked ...


Row inside a list view is not shown

I have a Row which contains some containers as children like this:
Row(
children: addEntities(),
),
where addEntities return a list of containers...
Now i want to scroll that row horizontall...


Dart - Polymer Custom Element not loaded

I've been following this tutorial for Dart:
https://www.dartlang.org/docs/tutorials/polymer-intro/
And as a quick test run I'm trying to set up a very basic thing - a page with a label and two in...


Flutter how to display different tabBars for different screens?

So In my app, there are three screens which can be navigated using a bottom bar, now for each of the three screens I want to display different navigation Tab bar but the same appBar,
what I tried ...


Next