Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Can't use google chart api facade due to missing constructor. #26

Open
@sureshg

Description

@sureshg

Generated the js-interop facade for Google visualization api and is missing the imp factory constructors for google chart types. All it has is the fakeConstructor$ instead one with HTMLElement . This makes the generated facade useless. As a workaround, I had to manually add the factory constructors for most of the chart types.

@JS("google.visualization.PieChart")
class PieChart extends CoreChartBase {
  // Manually added this factory constructor.
  external factory PieChart(Element element);
  // @Ignore
  PieChart.fakeConstructor$() : super.fakeConstructor$();

Sample App

I am not sure why we need the fakeConstructor$, is it just to satisfy the inheritance hierarchy?

Also, one of the other major pain point is missing type info from the generated facade.

  /*external void draw(DataTable data, PieChartOptions options);*/
  /*external void draw(DataView data, PieChartOptions options);*/
  external void draw(
      dynamic /*DataTable|DataView*/ data, PieChartOptions options);

Since dart doesn't support method overriding or union types, this dynamic conversion make it less type safe. Is there any plan to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions