12

Is it possible? I tried to insert the google dart api into page body and all I get is blank page, no script running...

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Aleksandar Toplek
  • 2,792
  • 29
  • 44
  • I read it is in chromium, the open source version of chrome. So you should on how to do dart in chromium. – unludo Feb 25 '12 at 09:51
  • I managed to get Dart working in browser (Chrome Dev channel) it that when i try to load script through extension, I get empty page... – Aleksandar Toplek Feb 29 '12 at 15:56

4 Answers4

8

You can currently not use Dart for writing extensions in Chrome as Dart is not available in it. There exists a Chromium version called Dartium that has Dart support build in, but the extension API in it does not seam to be Dart enabled just yet.

Lars Tackmann
  • 20,275
  • 13
  • 66
  • 83
6

There is the cool package chrome available at http://pub.dartlang.org that does axactly this

A library for accessing the Chrome APIs in a packaged app or extension.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
3

Yes, it is straight forward. You need to create 3 Dart apps (for background, popup and options page) and use the dart:js package to communicate with the chrome extensions API.

Kudos to Chris Bucket for the blog entry about Using Dart for Chrome Packaged Apps.

UPDATE: It looks like the website from Chris Bucket has disappeared.

Draško Kokić
  • 1,280
  • 1
  • 19
  • 34
  • 1
    https://web.archive.org/web/20150510002443/http://blog.dartwatch.com:80/2012/12/using-dart-for-chrome-packaged-apps.html – Loic Devaux May 31 '23 at 05:56
-1

Dart is isolated form javascript and there is no common points to make calls between them. You can't even call any JS function from Dart. As long there is no dedicated interface for extensions API it isn't possible. But I looking forward to have this feature as well :)

Pawel Uchida-Psztyc
  • 3,735
  • 2
  • 20
  • 41
  • 3
    To try and keep this answer up-to-date, there is now the [Dart JS Interop Library](http://www.dartlang.org/articles/js-dart-interop/) which allows you to call JavaScript from Dart. – Chris Buckett Jan 10 '13 at 09:25