[dart-announce] Dart 1.24 now awailable

257 views
Skip to first unread message

'Michael Thomsen' via Dart Announcements

unread,
Jun 13, 2017, 9:12:43 AM6/13/17
to Dart Announcements
Check out the announcement and the changelog!

Kind regards, the Dart team

-----



1.24.0

Language

  • During a dynamic type check, void is not required to be null anymore. In practice, this makes overriding voidfunctions with non-void functions safer.

  • During static analysis, a function or setter declared using => with return type void now allows the returned expression to have any type. For example, assuming the declaration int x;, it is now type correct to have void f() => ++x;.

  • A new function-type syntax has been added to the language. Intuitively, the type of a function can be constructed by textually replacing the function's name with Function in its declaration. For instance, the type of void foo() {} would be void Function(). The new syntax may be used wherever a type can be written. It is thus now possible to declare fields containing functions without needing to write typedefs: void Function() x;. The new function type has one restriction: it may not contain the old-style function-type syntax for its parameters. The following is thus illegal: void Function(int f())typedefs have been updated to support this new syntax.

    Examples:

    typedef F = void Function();  // F is the name for a `void` callback.
    int Function(int) f;  // A field `f` that contains an int->int function.
    
    class A<T> {
      // The parameter `callback` is a function that takes a `T` and returns
      // `void`.
      void forEach(void Function(T) callback);
    }
    
    // The new function type supports generic arguments.
    typedef Invoker = T Function<T>(T Function() callback);

Core library changes

  • dart:asyncdart:coredart:io

    • Adding to a closed sink, including IOSink, is no longer not allowed. In 1.24, violations are only reported (on stdout or stderr), but a future version of the Dart SDK will change this to throwing a StateError.
  • dart:convert

    • BREAKING Removed the deprecated ChunkedConverter class.
    • JSON maps are now typed as Map<String, dynamic> instead of Map<dynamic, dynamic>. A JSON-map is not a HashMap or LinkedHashMap anymore (but just a Map).
  • dart:io

    • Added Platform.localeName, needed for accessing the locale on platforms that don't store it in an environment variable.
    • Added ProcessInfo.currentRss and ProcessInfo.maxRss for inspecting the Dart VM process current and peak resident set size.
    • Added RawSynchronousSocket, a basic synchronous socket implementation.
  • dart: web APIs have been updated to align with Chrome v50. This change includes a large number of changes, many of which are breaking. In some cases, new class names may conflict with names that exist in existing code.

  • dart:html

    • REMOVED classes: BluetoothBluetoothDeviceBluetoothGattCharacteristicBluetoothGattRemoteServerBluetoothGattServiceBluetoothUuidCrossOriginConnectEvent,DefaultSessionStartEventDomSettableTokenListMediaKeyErrorPeriodicSyncEventPluginPlaceholderElementReadableStreamStashedMessagePortSyncRegistration

    • REMOVED members:

      • texImage2DCanvas was removed from RenderingContext.
      • endClip and startClip were removed from Animation.
      • after and before were removed from CharacterDataChildNode and Element.
      • keyLocation was removed from KeyboardEvent. Use location instead.
      • generateKeyRequestkeyAddedEventkeyErrorEventkeyMessageEventmediaGroupneedKeyEventonKeyAddedonKeyErroronKeyMessage, and onNeedKey were removed from MediaElement.
      • getStorageUpdates was removed from Navigator
      • status was removed from PermissionStatus
      • getAvailability was removed from PreElement
    • Other behavior changes:

      • URLs returned in CSS or html are formatted with quoted string. Like url("http://google.com") instead of url(http://google.com).
      • Event timestamp property type changed from int to num.
      • Chrome introduced slight layout changes of UI objects. In addition many height/width dimensions are returned in subpixel values (num instead of whole numbers).
      • setRangeText with a selectionMode value of 'invalid' is no longer valid. Only "select", "start", "end", "preserve" are allowed.
  • dart:svg

    • A large number of additions and removals. Review your use of dart:svg carefully.
  • dart:web_audio

    • new method on AudioContext – createIirFilter returns a new class IirFilterNode.
  • dart:web_gl

    • new classes: CompressedTextureAstcExtColorBufferFloatExtDisjointTimerQuery, and TimerQueryExt.

    • ExtFragDepth added: readPixels2 and texImage2D2.

Strong Mode

  • Removed ad hoc Future.then inference in favor of using FutureOr. Prior to adding FutureOr to the language, the analyzer implented an ad hoc type inference for Future.then (and overrides) treating it as if the onValue callback was typed to return FutureOr for the purposes of inference. This ad hoc inference has been removed now that FutureOr has been added.

    Packages that implement Future must either type the onValue parameter to .then as returning FutureOr<T>, or else must leave the type of the parameter entirely to allow inference to fill in the type.

  • During static analysis, a function or setter declared using => with return type void now allows the returned expression to have any type.

Tool Changes

  • Dartium

    Dartium is now based on Chrome v50. See Core library changes above for details on the changed APIs.

  • Pub

    • pub build and pub serve

      • Added support for the Dart Development Compiler.

        Unlike dart2js, this new compiler is modular, which allows pub to do incremental re-builds for pub serve, and potentially pub build in the future.

        In practice what that means is you can edit your Dart files, refresh in Chrome (or other supported browsers), and see your edits almost immediately. This is because pub is only recompiling your package, not all packages that you depend on.

        There is one caveat with the new compiler, which is that your package and your dependencies must all be strong mode clean. If you are getting an error compiling one of your dependencies, you will need to file bugs or send pull requests to get them strong mode clean.

        There are two ways of opting into the new compiler:

        • Use the new --web-compiler flag, which supports dartdevcdart2js or none as options. This is the easiest way to try things out without changing the default.

        • Add config to your pubspec. There is a new web key which supports a single key called compiler. This is a map from mode names to compiler to use. For example, to default to dartdevc in debug mode you can add the following to your pubspec:

          web:
            compiler:
              debug: dartdevc

        You can also use the new compiler to run your tests in Chrome much more quickly than you can with dart2js. In order to do that, run pub serve test --web-compiler=dartdevc, and then run pub run test -p chrome --pub-serve=8080.

      • The --no-dart2js flag has been deprecated in favor of --web-compiler=none.

      • pub build will use a failing exit code if there are errors in any transformer.

    • pub publish

      • Added support for the UNLICENSE file.

      • Packages that depend on the Flutter SDK may be published.

    • pub get and pub upgrade

      • Don't dump a stack trace when a network error occurs while fetching packages.
  • dartfmt

    • Preserve type parameters in new generic function typedef syntax.
    • Add self-test validation to ensure formatter bugs do not cause user code to be lost.

Infrastructure changes

  • As of this release, we'll show a warning when using the MIPS architecture. Unless we learn about any critical use of Dart on MIPS in the meantime, we're planning to deprecate support for MIPS starting with the next stable release.

--
For more news and information, visit https://plus.google.com/+dartlang
 
To join the conversation, visit https://groups.google.com/a/dartlang.org/

Vadim Tsushko

unread,
Jun 14, 2017, 2:24:45 AM6/14/17
to mi...@dartlang.org, anno...@dartlang.org

After upgrading to SDK 1.24.0 WebStorm IDE stop working for me. `import` statements bacame underscored with red lines, with error message `resource not found`
When I run dartanalizer from the command line - there are no errors though.
I've tried some usual remedies: Removed pub cache, have tried stable and dev release of SDK, have updgraded WebStorm from 2017.1.2 to 2017.1.4 - nothing worked out. 
Only the downgrade to SDK 1.23 helped. I'm on Windows 10.

István Soós wrote that he had the same experienve with SDK 1.24.0 and IndellyJ IDEA. For him too only downgrade to 1.23.0 worked out.



Vadim Tsushko

unread,
Jun 14, 2017, 6:19:24 AM6/14/17
to Dart Misc, anno...@dartlang.org
It looks like these problems arise only when one work with specific project layout - group of dart subprojects lay in one directory with WebStorm/IntellyJ opening that parent directory. Like in that test repo: https://github.com/vadimtsushko/dir_with_subprojects

I've created that repo hoping to reproduce problems, but they appear sporadically and then disappear. On real work project (which is bigger and have more subprojects) errors are pretty stable though.

Vadim Tsushko

unread,
Jun 14, 2017, 7:41:26 AM6/14/17
to Dart Misc, anno...@dartlang.org
Apparently I worked with multiple projects in WebStorm in a not supported manner. Instead of opening parent directory, containing multiple dart projects, I shoud add all these subprojects as content roots to empty project.
In such a way nothing breaks with new SDK.

Sorry for noise. 

Alexander Doroshko

unread,
Jun 14, 2017, 7:49:14 AM6/14/17
to mi...@dartlang.org
Vadim,

Configuring a single-root project with multiple Dart projects in
subfolders (at any level) is totally valid and is supported.

This might be an IDE-side issue, but so far it sounds more like an
Analysis Server issue. If you have a sample project and/or steps to
reproduce please open an issue in https://github.com/dart-lang/sdk/issues.

Thanks!

Joel Trottier-Hébert

unread,
Jun 14, 2017, 8:12:10 AM6/14/17
to mi...@dartlang.org
Vadim did you add a dependency to the resource package? Just a wild guess. 

--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Danny Tuppeny

unread,
Jun 14, 2017, 8:23:10 AM6/14/17
to mi...@dartlang.org

I don't think it's this (since this isn't new to 1.24) but the analyser does have issues if you put things inside a folder named "packages". I've had to put some hacks in Dart Code to avoid this causing issues for the Flutter repo:

https://github.com/dart-lang/sdk/issues/29414

Vadim Tsushko

unread,
Jun 14, 2017, 8:29:31 AM6/14/17
to Dart Misc
No, I have hade some problems with resource package, so I do not use it anymore. Just checked up, looks like my bug in package is still open https://github.com/dart-lang/resource/issues/16

среда, 14 июня 2017 г., 17:12:10 UTC+5 пользователь Joel Trottier-Hébert написал:

Петър Събев

unread,
Jun 14, 2017, 5:12:23 PM6/14/17
to mi...@dartlang.org
We have the same problems too - multiple projects in InteliJ as Vadim Tsushko described....


Vadim Tsushko

unread,
Jun 15, 2017, 2:22:49 AM6/15/17
to Dart Misc
Have you tried to make project with multiple content roots instead of single parent directory? For me it resolved the problem.

четверг, 15 июня 2017 г., 2:12:23 UTC+5 пользователь Петър Събев написал:

Devon Carew

unread,
Jun 15, 2017, 8:51:36 AM6/15/17
to General Dart Discussion
Vadim, it sounds like your issue was resolved by using multiple content roots. Had the previous project structure worked for you (one content root with multiple projects?)

Similarly - Петър - is this a regression with this SDK? Something that had been working for you previously?

I did try to repro with with the given repository (https://github.com/vadimtsushko/dir_with_subprojects) and did not see issues. Perhaps as noted above it's too small.

If you can open an issue at http://www.dartbug.com/new, we can better track the discussion and any fix. Thanks!


--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.



--
Devon Carew
Software Engineer
Google, Inc.

Петър Събев

unread,
Jun 15, 2017, 9:53:19 AM6/15/17
to mi...@dartlang.org
I've tried what Vadim suggested and it worked for me too - using multiple roots for the project.
Devon Carew - yes this problem came for me with the new SDK (1.24 and 1.24.1 too).

Vadim Tsushko

unread,
Jun 15, 2017, 10:35:52 AM6/15/17
to Dart Misc


четверг, 15 июня 2017 г., 17:51:36 UTC+5 пользователь Devon Carew написал:
Vadim, it sounds like your issue was resolved by using multiple content roots. Had the previous project structure worked for you (one content root with multiple projects?)


Yes, previously it worked for me. I work in such environment something like last year (From the start of using https://github.com/Andersmholmgren/jefe , and it worked for me all this time.

Vadim Tsushko

unread,
Jun 16, 2017, 2:53:36 AM6/16/17
to mi...@dartlang.org
Update: After a while I started to get these errors in project with multiple content roots too. So my workaround actually does not work for me anymore. I'm switching to SDK 1.23 for now.

Istvan Soos

unread,
Sep 15, 2017, 12:14:01 PM9/15/17
to General Dart Discussion
I'm wondering if anybody was able to find a fix for this?


On Fri, Jun 16, 2017 at 8:53 AM, Vadim Tsushko <vadimt...@gmail.com> wrote:
> Update: After a while I startet to get these errors in project with multiple
> content roots too. So my workaround actually does not work for me anymore.
> I'm switching to SDK 1.23 for now.
>

Istvan Soos

unread,
Sep 22, 2017, 12:45:43 PM9/22/17
to General Dart Discussion
In case somebody stumbles on this: In my case, one root cause was that
a parent-directory (parent-module) got Dart-enabled, and that screws
up the project. Only the lowest-level modules should be Dart-enabled,
and if you accidentally enable the parent ones, you need to deselect
them in the Settings / Plugins / Dart... (or similar).

Cheers,
Istvan
Reply all
Reply to author
Forward
0 new messages