Skip to content

question: build error while adding an event listener #227

Closed
@caleb-at-pieces

Description

@caleb-at-pieces

I am attempting to add an event listener on the window like so:

import 'dart:html';
import 'dart:js_interop';
import 'package:web/web.dart' as js;


void main() {
  runApp(const MyApp());
  try {
    js.window.addEventListener('message', test.toJS);
  } catch (e) {
    print('there was an err $e');
  }
}

void test(Event _) {
  print('test invoked');
}

however whenever I try to build my application I get this build error:

image

I saw someone faced this same issue here #212 (comment) however after trying to replicate their code I still face the same issue

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