js_wrapping_generator 0.5.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 45

Dart Js Wrapping generator #

A generator of Js wrappers. See js_wrapping package for details.

See CHANGELOG of the js_wrapping package for details.


// Copyright (c) 2015, Alexandre Ardhuin. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.

library js_wrapping_generator.example.js_proxy;

import 'package:js_wrapping/js_wrapping.dart';
import 'package:js_wrapping/util/state.dart';

part 'example.g.dart';

abstract class _JsFoo implements JsInterface {
  static int get static1 => $js;
  static int static2;
  static int staticMethod(JsFoo foo) => $js;

  factory _JsFoo() => null;

  List l1;
  List<num> l2;
  List<JsFoo> l3;

  int i;

  num k1, k2;
  int j = null;
  bool get l;

  String get a;
  void set a(String a);

  String get b => '';
  void set b(String b) {}

  void m2();
  String m3();
  String m4(int a);
  int m5(int a, b);
  int _m6(int a, b);

callM6(JsFoo foo) => foo._m6(1, 2);

abstract class _JsBar extends JsInterface {
  _JsBar.created(JsObject o) : super.created(o) {
    getState(this).putIfAbsent(#a, () => 0);

  factory _JsBar() = dynamic;
  factory _JsBar.named(int x, int y) = dynamic;

  JsBar m1();

  void set a(int a) {
    getState(this)[#a] = a;

  int get a => getState(this)[#a] as int;

abstract class _JsBaz extends JsBar {
  factory _JsBaz() = dynamic;

abstract class __Context implements JsInterface {
  int find(String a);

  String a;

  String get b;

  set b(String b1);

final _context = new _Context.created(context);

final find = _context.find;
String get a => _context.a;
void set a(String _a) {
  _context.a = _a;

String get b => _context.b;
void set b(String _b) {
  _context.b = _b;

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  js_wrapping_generator: ^0.5.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:js_wrapping_generator/js_wrapping_generator.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21


Detected platforms: other

Primary library: package:js_wrapping_generator/js_wrapping_generator.dart with components: io, isolate, build, mirrors.

Health issues and suggestions

Document public APIs. (-0.60 points)

73 out of 74 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/js_wrapping_generator.dart. (-1.49 points)

Analysis of lib/js_wrapping_generator.dart reported 3 hints:

line 73 col 21: 'element' is deprecated and shouldn't be used.

line 171 col 9: DO use curly braces for all flow control structures.

line 555 col 47: 'bestElement' is deprecated and shouldn't be used.

Fix lib/src/incremental_generator.dart. (-0.50 points)

Analysis of lib/src/incremental_generator.dart reported 1 hint:

line 43 col 9: DO use curly braces for all flow control structures.

Maintenance issues and suggestions

Support latest dependencies. (-30 points)

The version constraint in pubspec.yaml does not support the latest published versions for 3 dependencies (analyzer, build, source_gen).

Package is getting outdated. (-30.41 points)

The package was last published 68 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.67.0 <3.0.0
analyzer ^0.32.3 0.32.6 0.39.1
build ^0.12.7 0.12.8 1.2.2
js_wrapping 0.5.0 0.5.0
path ^1.5.1 1.6.4
source_gen ^0.8.3 0.8.3+1 0.9.4+6
Transitive dependencies
args 1.5.2
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
dart_style 1.1.3 1.3.3
front_end 0.1.4+2 0.1.29
glob 1.2.0
html 0.14.0+3
js 0.6.1+1
kernel 0.3.4+2 0.3.29
logging 0.11.3+2
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pedantic 1.8.0+1
plugin 0.2.0+3
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.2.0
Dev dependencies
build_runner ^0.9.1
build_test ^0.10.2+5
test ^1.3.0