Questions tagged [dart-2]

Dart 2 is changing the Dart language in many ways, some of which are not backward-compatible.

60 questions
2
votes
1 answer

Getting error when trying to set min width using ButtonTheme

I am trying to set minWidth in ButtonTheme. I am getting following error: Error: Getter not found: 'context'. compiler message: minWidth: MediaQuery.of(context).size.width-40, For reference I am sharing code here: final resetButton =…
Code Hunter
  • 10,075
  • 23
  • 72
  • 102
2
votes
1 answer

Cannot omit 'new' keyword despite using Dart 2.0

When i run the tests of my application i get this exception: NoSuchMethodError: Attempted to use type 'SimplePipe' as a function. Since types do not define a method 'call', this is not possible. Did you intend to call the SimplePipe constructor and…
Tobias Marschall
  • 2,355
  • 3
  • 22
  • 40
2
votes
1 answer

Unable to run Dart2 w/ Angular for web along side Flutter for mobile project - plan to share code

I have made good progress with Flutter on mobile apps. Currently using: [✓] Flutter (Channel master, v0.3.1-pre.13, on Mac OS X 10.13.4 17E199, locale en-US) • Flutter version 0.3.1-pre.13 at /Users/golftocs/PhpstormProjects/flutter • Framework…
Larry King
  • 419
  • 6
  • 19
2
votes
1 answer

Dart cannot read readAsStringSync

I am using Dart VM version: 1.24.3 (Wed Dec 13 23:26:59 2017) on "macos_x64" WITH Flutter 0.2.8 • channel beta Framework • revision b397406561 (13 days ago) Engine • revision c903c217a1 Tools • Dart 2.0.0-dev.43.0.flutter-52afcba357 ReadAsStringSync…
1
vote
1 answer

From given two lists, how to extract all the elements from one list that are not available in the other list in Dart?

I have two lists in Dart as below, final List availableIssueComponents = [ {'id': 1, 'componentName': 'Cash Acceptor'}, {'id': 2, 'componentName': 'Printer'}, {'id': 3, 'componentName': 'PIN Pad'}, {'id': 4, 'componentName': 'Key…
gfit21x
  • 141
  • 9
1
vote
0 answers

Failed assertion: line 42 pos 16: 'path.isNotEmpty': is not true. flutter

I keep getting this error and I'm not sure what to do so I am back again with the issue related to the question already posted by me on stack overflow Error: Failed assertion: line 42 pos 16: 'path.isNotEmpty': is not true. flutter The 42 pos 16: is…
1
vote
2 answers

Does dartpad not support I/O?

Recently I was trying out some code snippets from "Dart For Absolute Beginners" on DartPad. Specifically: import 'dart:math'; import 'dart:io'; void main() { int guess; Random rand = new Random(); //create a random number generator int…
Jay
  • 110
  • 10
1
vote
1 answer

What is an equivalent for Dart 2 to `typeof` of TypeScript?

I'm new to Dart 2. I want a class to have a property. It's a reference of other class. it's not an instance but class itself. In TypeScript, it's possible to write as below. Is there a same way in Dart 2? class Item { } class ItemList { …
takanopontaro
  • 217
  • 1
  • 2
  • 12
1
vote
1 answer

NNBD: Least upper bound of String and Null

Working on a patch for some issues in the Dart Analyzer, I need to understand whether Null itself is considered a nullable type. Currently, the least upper bound computed by Dart’s type algebra for String and Null is String. However, in my opinion,…
user3612643
  • 5,096
  • 7
  • 34
  • 55
1
vote
4 answers

Dart - Double datatype addition results in long decimal values

In the following program I am adding the list of doubles. The output I am expecting is 57.7 but it results in 57.699999999999996 void main() { List list= [1.0,1.0,1.0,1.0,0.8,52.9]; double total = 0.0; list.forEach((item) { total…
user1996206
  • 98
  • 1
  • 10
1
vote
0 answers

Conditional redirect on an angular dart page

I have a page (A) in Angular Dart 2 that would be visible based on a condition. If the condition is false, it should redirect to page B I can implement this logic using router.navigate in onActivate or onInIt or other hooks. However, …
marcg
  • 552
  • 1
  • 8
  • 20
1
vote
0 answers

Connecting to a mySQL database on dart 2

I was looking for a way to connect to a mysql database using dart. I found the same question: How to connect mysql Database with Dart? unfortunately, sqljocky is not dart 2 compatible, so my question is whether there exists a replacement that is…
Ran Elgiser
  • 66
  • 1
  • 1
  • 14
1
vote
3 answers

How to update StatefulWidget from other StatefulWidget?

I'm having screen with 3 tabs. All has different views. When user come to the screen, I've to hit the API and update the views for all 3 tabs. I'm not able to update view inside tabs. Not able to update the states of different tabs after getting API…
Anuj Sharma
  • 4,294
  • 2
  • 37
  • 53
1
vote
0 answers

Problems with strong mode in Dart 2.0

I am currently learning Flutter and Dart to try to expand my knowledge. The problem I'm having is due to changing from Dart 1.0 to Dart 2.0, leading me to think that the problem resides in the change of type mode. My code: I'm playing with a Spotify…
olmedocr
  • 198
  • 3
  • 12
1
vote
2 answers

Can dynamic type in Dart 2 assign to several value of difference type?

Can dynamic type in Dart 2 assign to value of difference type and how compile infer them? For example what is x type in dart 2 and does this compile? dynamic x = 1; x = x + "Hello";
Saeed Zarinfam
  • 9,818
  • 7
  • 59
  • 72