Inconsistent error reporting from Dart Editor regarding final fields

Given the following class, Dart Editor (build 5549) gives me some conflicting feedback (per the comments in the constructor body): class Example { final int foo; Example() : foo = 0 { foo = 1; // 'cannot assign value to final variable "foo"' = 2; // ok } } Even more confusingly, it will happily generate equivalent (working) javascript for both lines. The situation seems to be the same with methods as it is with the constructor; this especially leads me to belie

Dart Server with Web Components

I'd like to pass the user information from my user registration form to a web-component. Is this possible. Something like below: app.addRequestHandler( (req) => req.method == 'POST' && req.path == '/newUser', (req, res) { ... input.onClosed = () { ... var user = new User(); = params["user[first_name]"]; = params["user[email]"]; res.outputStream.writeString('<x-MyWebComponent data-value="User: user"></x-MyWebCompo

How to disable stdin echo in a dart console application for password input

The example below will read in a user's password but also echo it in plain text, is there a way around this? Future<String> promptPassword() { var completer = new Completer<String>(); var stream = new StringInputStream(stdin); stdout.writeString("Warning: Password will be displayed here until I find a better way to do this.\n"); stdout.writeString("Watch your back...\n"); stdout.writeString("GitHub password for $gituser: "); stream.onLine = () { var str =

What relevance do folders have in a dart project?

When I create a sub folder in a Dart Project in Dart Editor, immediately a package subfolder is created inside this sub folder. I have not read anywhere that sub folders have a special meaning for the project structure, but it appears they do. Anybody knows more?

Is there an event delegation in dart SDK?

Imagine, you want to listen to all clicks made to any anchor element on page. The anchors on page can be dynamically added/removed during the page lifetime and you want to register all of the click events, even on newly added. Is there any way how to attach delegated event (like in jQuery) in Dart using its standard libraries? In jQuery you can achieve this with element.on('click', '.selector', handler);.

Dart How can I disable setter generation without using final?

For fun and to learn, I'm building a simple game engine with Dart. I have defined an abstract Game class. A Game has a Director director field which manages scene transitions. This class is also abstract. Each concrete game must implement its own concrete Game and Director classes, say MyGame and MyDirector. I'm setting Game's director like this: abstract class Game { Director director; Game() { director = createDirector(); } Director createDirector(); } MyGame (which inherits

How to define global template variable in AngularDart

I have simple template with tabs which are switching controlers in template <ul> <li><a href="#" ng-click="tab = 1">Users</a></li> <li><a href="#" ng-click="tab = 2">Games</a></li> </ul> <div class="tab" ng-hide="tab != 1 && tab != null" users>...</div> <div class="tab" ng-hide="tab != 2" games>...</div> Everything work as expected, but in new update of dart editor variable "tab" is marked as

Dart Infinite file watcher

Hello I'm trying to implement file watcher in Dart. And the problem is that I can't figure out how to make forever lister for stream. In my code print statement fires only once, when file was changed. I tried while(true){} but didn't make affect. import "dart:io"; void main(){ List<String> paths = ['any.dart']; paths.forEach((fp){ File f = new File(fp);{ print(e); }); }); } Dart info: Dart VM version: 1.4.0 (Tue May 20 04:56:35 2014) on "li

Why dart editor is still running

I am very confuse about dart editor, how it works. When i run this application import 'dart:isolate'; import 'package:dbcrypt/dbcrypt.dart'; import 'dart:async'; main() { //ReceivePort receivePort = new ReceivePort(); var receivePortPw = new ReceivePort(); receivePortPw.listen((msg) { print(msg); }); Future<Isolate> f = Isolate.spawn(ReturnHashedPassword, receivePortPw.sendPort); f.then((Isolate i) { print('Print1 -> ' + new DBCrypt().hashpw('Password', new

How can the different core-icons iconsets be used in Dart?

core-icons contains different iconsets like icons av-icons communication-icons device-icons hardware-icons image-icons maps-icons notification-icons png-icons social-icons It's not obvious how to use them.

Google Dart Paper Button Selector

I cannot seem to create a paper button that allows me to use it as a selector for closing a paper-dialog. I have a feeling this is a CSS issue, but I could be wrong. The button gets created after all of the elements and when you switch tabs, it essentially re-creates the button into a new div. Below is my code for the CSS, Dialog setup, and the Dart code. Please let me know if you need more information from me. Dart and markup: PaperButton button; button = new PaperButton();

dart, how to define a class so it can be used as a class attribute?

I've seen in polymer.dart they have: class CustomTag { final String tagName; const CustomTag(this.tagName); } but how does that interact with the rest of the code? from just the code above I can't see how using @CustomTag('my-tag') actually does anything but creates a CustomTag which is then garbage collected since nothing is referencing it.

Dart Forcing a paper-dialog to be the topmost window

I created a dialog and it renders. However, it can be hidden by its parent if the window is small. I tried the layered attribute on PaperDialog layered attribute it does not seem to help. others.html <!DOCTYPE html> <link href='../../../../packages/polymer/polymer.html' rel='import' > <link href='../../../../packages/bwu_datagrid/bwu_datagrid.html' rel='import' > <link href='../../../../packages/paper_elements/paper_input.html' rel='import' > <polymer-element na

Dart Maps in Lists in Maps

After much trial and error, I am at a loss as to how to deal with embedded lists and maps in Dart and furthermore, how they can be accessed via Polymer data binding. The objective is to read a JSON file and build an HTML table that can be filtered and sorted. (I just hard coded map data below for clarity.) I can build an HTML table within my Polymer element (see buildTable) as long as the Map looks like testMap3 seen in the Dart code below and it renders fine with: HTML: <p>

Is the test.dart package working

I am trying to run a simple test copied from library epimss_reg.test; import 'package:test/test.dart'; //import 'package:epimss_reg/epimss_reg.dart'; import "dart:async"; void main() { test("Stream.fromIterable() emits the values in the iterable", () { var stream = new Stream.fromIterable([1, 2, 3]); stream.listen(expectAsync((number) { print(number); expect(number, inInclusiveRange(1, 7));

Dart How to know if a certain future is complete by avoiding a chain of future as return types?

Scenario If I want to read from a file and store the data in a Map, and if that map is being used multiple times for validation. Is it possible for me to do this without having to change the return type of all methods, that use the above mentioned map, to Future? Example: Map metadata = null Future readFromFile async { .... metadata = await File.readingfromFile(...); } Future getRegion(..) async { if(metadata == null) { await readFromFile() } return metadata["region"] } Using the abo

Dart Order of event listeners

Is there a way to manually order the execution of event listeners for the same element? For example If I have two methods that has onClick() listeners. void A(Element el) { el.onClick((event) => model.get("inside")); } void B(Element el) { .... el.onClick((event) => expect(model.get("inside"), isNotNull)); .... } Thanks, everyone.

Is Dart Dev Compiler supposed to support dart:io?

I tried compiling a simple HttpServer.bind with DDC and it seems to throw a runtime error saying "Operation not supported" on that line. Am I doing something wrong, or is DDC not supposed to support that?

Dart Track radio button chosen in flutter

I have written the code below for a quiz app but am stuck on finding a way to compare the selected radio button with the correct ans and also delaying the transition to the next question sufficiently for a visual indication of the choice made. Tried using switch statement and the _counter variable but results into an error The following NoSuchMethodError was thrown while handling a gesture: I/flutter (28574): The method '[]' was called on null. I am not familiar enough to understand where/wha

Material Progress Bar for AngularDart

Error: Package material_progress has no versions that match >=1.0.0 <2.0.0 derived from: - your_next_startup depends on version ^1.0.0 app_component.html `<material-progress [activeProgress]="10" [secondaryProgress]="30"></material-progress> <material-progress [indeterminate]="true"></material-progress>` app_component.dart import 'package:angular2/angular2.dart'; import 'package:angular_components/angular_components.dart'; import 'package:your_nex

Dart White space under navigation bar in drawer

I encountered an annoying styling issue where if I opened my drawer I would get white space under the navigation bar on Android. Whereas if I wasn't in the drawer it would display the correct color just fine. I'm using the following code for my drawer widget: drawer: new Drawer( child: new ListView( children: <Widget>[ new UserAccountsDrawerHeader( accountEmail: new Text(""), accountName: new Text("Linus Juhlin"),

Dart How to preserve widget states in flutter, when navigating using BottomNavigationBar?

I'm currently working on building a Flutter app that will preserve states when navigating from one screen, to another, and back again when utilizing BottomNavigationBar. Just like it works in the Spotify mobile application; if you have navigated down to a certain level in the navigation hierarchy on one of the main screens, changing screen via the bottom navigation bar, and later changing back to the old screen, will preserve where the user were in that hierarchy, including preservation of the s

Dart Flutter How to prevent child from Rotating with Parent?

How to prevent a child Text from Rotating along with Parent? This is sample code of what I have. I do not want the Text widget to rotate along with the parent Container. Is there an efficient way of doing it? Else I may have to wrap the child Text in another Transform.rotate and rotate it back. class MyRotateContainer extends StatefulWidget { @override _MyRotateContainerState createState() => new _MyRotateContainerState(); } class _MyRotateContainerState extends State<MyRotateContaine

Dart Flutter Right-to-Left rtl wrapped multiline text hide first letter

Nothing is working to get multiline text to be wrapped with Right aligment @override Widget build(BuildContext context) { var tt = "ومن رأى: أن إبرته التي يخيط بها انكسرت أو انتزعت منه، فإن شأنه يتفرق ويفسد أمره، وتدل الإبرة أيضاً على المرأة لإدخال الخيط فيها، وكذلك المسلة، فمن رأى أن بيده مسلة وكانت إمرأته حبلى ولدت له إبنة، وإن لم يكن هناك حمل دل ذلك على سفره."; return new Scaffold( appBar: new AppBar( title: new Text(gettitle()) , ), body:

Dart How to test navigation via Navigator in Flutter

Let's say, I have a test for a screen in Flutter using WidgetTester. There is a button, which executes a navigation via Navigator. I would like to test behavior of that button. Widget/Screen class MyScreen extends StatefulWidget { MyScreen({Key key}) : super(key: key); @override _MyScreenState createState() => _MyScreenScreenState(); } class _MyScreenState extends State<MyScreen> { @override Widget build(BuildContext context) { return Scaffold( body: Center(

Dart How to select an item from a List in flutter

I have list from a model like this amount:"12000" dateTime:"19/07/2018" detail:"Soto" hashCode:853818549 id:1 name:"Theodorus" I want to just select amount and add it to another list of string, but I'm always getting this error A value of type 'String' can't be assigned to a variable of type 'List<String>'. , I thinks its because im not doing it right, here is my code below void setupList() async { DebtDatabase db = DebtDatabase(); listCache = await db.getMyDebt(); setSta

Dart Flutter standard packages

As I see several dart packages published at dart package website, I am curious to know what packages does flutter endorse? The question would be vague, so I would like to focus on a specific package dio. I have contacted few flutter developers, and have been told that the package is not yet a industry standard, also I was introduced to some packages that were published just hours back, for example jaguar_retrofit. I also see dart https package used frequently in flutter documentation. This we

Dart Getting the value from a custom input widget

I made a custom input widget by wrapping Textfield in some widgets and so on. Now I can't reach the onChanged property directly from the custom widget. I tried making a property in my custom widget but couldn't implement it properly. I googled passing variables between widgets and it seems a hard thing to do. Any simple solution? class Input extends StatelessWidget { final String text; final TextInputType type; final int maxLength; final bool password; final String label; final Icon

Dart How do I disable the chip selected icon in a Flutter Raw Chip?

I wanted to create a TabBar with chips as Tabs like this: The code is: class TabChip extends StatefulWidget{ final String chipTitle; TabChip(this.chipTitle) : assert(chipTitle != null); @override State<StatefulWidget> createState() { return _TabChipState(); } } class _TabChipState extends State<TabChip>{ bool isSelected = false; @override Widget build(BuildContext context) { return RawChip( avatar: CircleAvatar(), label: Text(widget.chipT

Dart Missing Https Headers For Pusher ChatKit Api

i'm trying to get ChatKit to FlutterSDK, but i'm facing a little tiny problem ,, i'm sending request to ChatKit End Point ,, but i think i'm missing headers so i never get authed ,, (reponse Code 401) so what i should use as header? i was trying to connect via Dart Http Package static String _apiEndPoint = ""; static final String _usersEndPoint = "/users"; var uri = Uri.parse("$_apiEndPoint$_usersEndPoint"); var r

Dart How would I get all the Files in a bucket from Fire Storage and iterate through the files?

I am storing images in Firebase Storage, no more than 6/user. Its stored in bucket Photos/Userid/"Image_name" The Image_name is either Photo1,2...6 depending on grid.index and thats all. I've tried a bunch of methods to retrieve the bucket so i can iterate through 6 or less than 6 images in the bucket assigned to by user ID. I have not been successful. I am simply trying to take the 6 or <6 images and save them locally to an object File Photo1,2..6. I just cant seem to retrieve the things

Dart Obtain hex string from the ECPrivateKey and ECPublicKey objects

I'm trying to use pointy castle to generate a public and private keypair using the secp256k1 curve. I think i have successfully created an AsymmetricKeyPair composed of an ECPrivateKey and ECPublicKey but i can't obtain their corresponding hex strings (something like this: private: ee792658c8eb1f8c3d2010ee6bc2ea328bb584fbecbfb17cf0f9103d122a8716, public: 041b3f87beb2559aa3ca1c1d9ebb9447e4842d21cf0c70db103acc0db27ea8c27536fc2b1405b8a16a460ca089b01de8c556825927b4890b7236e357787f3e6d54). Whe

String isn't a type.dart(not_a_type)

I'm relatively new to Dart and Flutter and I'm running in a basic error I'm not able to fix at the moment. I get the following error in VS Code: String isn't a type.dart(not_a_type) That's my code snippet: [String] getIntArrayFor({PurposeEnum purpose, String categoryName}){ switch(purpose){ case PurposeEnum.somePurpose: return []; default: return []; } } The error is marked at both String keywords in the function header. Does

Dart How to update screen, based on LoginInputField, before keyboard is Dismissed?

I have a simple login screen with an email and password LoginInputField. When the fields are empty, the login button is greyed out and disabled. When they both have text in them, the button is enabled. What I have works, but it will not update until the user has dismissed the keyboard. I want the user to be able to click the button without needing to first dismiss the keyboard. I have TextEdditingControllers on the LoginInputFields, and check the state of the controllers during the build and se

Dart flutter CocoaPods err (running pod install)

When I run flutter run, CocoaPods' errr , Error running pod install flutter stable, updata pod, CocoaPods CocoaPods' output: ↳ Preparing Analyzing dependencies Inspecting targets to integrate Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``) Fetching external sources -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios` -> Fetching podspec for `barcode_scan` from `.symlinks/plugins/barcode_scan/ios` -> Fetching po

Dart How to modify a reference variable by another class?

The problem is when I give my variable (String) as a parameter to a function it stay as it is. It's like there is only passing by value. void main() { String quote = "search"; print(quote); f(quote); print(quote); } void f(String txt) { txt = "find"; } Result is : search search What I want is : search find

Dart accessing object values using variable as a key

I'm trying to access a class value by using a variable previously defined in dart, but I keep getting the error the operator [] isn't defined for the class In Javascript I would access an object value using a variable like this: let movie = { movieTitle : 'Toy Story', actor: 'Tom Hanks' } let actorName = 'actor'; console.log(movie[actorName]); // <- what I'm trying to replicate in dart // expected output: Tom Hanks Here is what I've tried and is throwing that error class Movie { S

TCP input data packets are combined in Dart

I have a simple TCP client in dart: import 'dart:io'; void main() { const sendData = "\$I,Z,0.5,5,0*\r\n"; final socket = Socket.connect("", int.parse("8008")) .timeout(Duration(seconds: 5)) .whenComplete(() { print("Connected!"); }).catchError((_) { print("Error!"); }); socket.then((soc) { soc.write(sendData); soc.listen((data) { print(String.fromCharCodes(data).trim); }); }); } This program sends a special message to server an

How can I reduce method duration? in Dart for loop ,If the index of the list is about 700,000, it takes 13 seconds. How can I reduce 'for Loop'?

Here is the code to create a combination with the trotter package and add it to the list. If there are about 1 million indexes, the method execution takes over 13 seconds. It seems to be taking too long and I am looking for a solution. import 'package:trotter/trotter.dart'; void main() { comboValue(); } List<int> _choiceNumbers = List.generate(30, (i) => i); void comboValue() { final start =; List<List> combosList = []; if (_choiceNumbers.length >= 6) {

How do I get from Iterable<Future<MyType>> to Future<List<MyType>> in Dart

I want to load multiple descriptions from an async-function one-by-one by using map: Future<List<Description>> loadDescriptions(List<String> questions) async { Iterable<Future<Description>> iterable = async => (await loadDescription(question))); return iterable.toList(); } .toList() unfortunately doesn't work here. Is there a way to rewrite the code in dart so that I get Future<List<Description>> as output

How to split a string by multiple delimiters in Dart

If I have a string like this: final myFancyCodez = "AA-BB.CC_DD.EE"; how can I split it on more than one delimiter? expect(fancy.multiSplit( ["-", "."] ), ["AA", "BB", "CC_DD", "EE"] ); expect(fancy.multiSplit( [] ), ["AA-BB.CC_DD.EE"] ); expect(fancy.multiSplit( ['_'] ), ["AA-BB.CC", "DD.EE"] );

  1    2   3   4   5   6  ... 下一页 最后一页 共 44 页