service_worker icon indicating copy to clipboard operation
service_worker copied to clipboard

_delegate in PushMessageData is null , unable to get gcm message data

Open lukechi1219 opened this issue 6 years ago • 1 comments

Hi István,

I change code in worker.dart and the log seems show that: PushMessageData . _delegate is null can you help with this? Many Thanks.

onFetch.listen((FetchEvent event) { if (worker.pushHandler != null) { onPush.listen((PushEvent event) { PushMessageData data = event.data;

print(data == null); --> false print(data.text()); --> NullError: method not found: 'text' on null. js_primitives.dart:30

Future f = worker.pushHandler(new PushContext()); if (f != null) { event.waitUntil(f.then(() => null, onError: (_) => null)); } }); }

print(data.text()); --> NullError: method not found: 'text' on null. js_primitives.dart:30

class PushMessageData { // Masked type: facade.PushMessageData final delegate; PushMessageData.(this._delegate);

/// Extracts the data as a plain text string. String text() => _callMethod(_delegate, 'text', []); }

lukechi1219 avatar Sep 30 '17 17:09 lukechi1219