@@ -321,22 +321,34 @@ class OneSignal {
321321 /// Send a normal outcome event for the current session and notifications with the attribution window
322322 /// Counted each time sent successfully, failed ones will be cached and reattempted in future
323323 Future <OSOutcomeEvent > sendOutcome (String name) async {
324- Map <dynamic , dynamic > json = await _outcomesChannel.invokeMethod ("OneSignal#sendOutcome" , name);
325- return new OSOutcomeEvent (json.cast <String , dynamic >());
324+ var json = await _outcomesChannel.invokeMethod ("OneSignal#sendOutcome" , name);
325+
326+ if (json == null )
327+ return new OSOutcomeEvent ();
328+
329+ return new OSOutcomeEvent .fromMap (json.cast <String , dynamic >());
326330 }
327331
328332 /// Send a unique outcome event for the current session and notifications with the attribution window
329333 /// Counted once per notification when sent successfully, failed ones will be cached and reattempted in future
330334 Future <OSOutcomeEvent > sendUniqueOutcome (String name) async {
331- Map <dynamic , dynamic > json = await _outcomesChannel.invokeMethod ("OneSignal#sendUniqueOutcome" , name);
332- return new OSOutcomeEvent (json.cast <String , dynamic >());
335+ var json = await _outcomesChannel.invokeMethod ("OneSignal#sendUniqueOutcome" , name);
336+
337+ if (json == null )
338+ return new OSOutcomeEvent ();
339+
340+ return new OSOutcomeEvent .fromMap (json.cast <String , dynamic >());
333341 }
334342
335343 /// Send an outcome event with a value for the current session and notifications with the attribution window
336344 /// Counted each time sent successfully, failed ones will be cached and reattempted in future
337345 Future <OSOutcomeEvent > sendOutcomeWithValue (String name, double value) async {
338- Map <dynamic , dynamic > json = await _outcomesChannel.invokeMethod ("OneSignal#sendOutcomeWithValue" , {"outcome_name" : name, "outcome_value" : value});
339- return new OSOutcomeEvent (json.cast <String , dynamic >());
346+ var json = await _outcomesChannel.invokeMethod ("OneSignal#sendOutcomeWithValue" , {"outcome_name" : name, "outcome_value" : value});
347+
348+ if (json == null )
349+ return new OSOutcomeEvent ();
350+
351+ return new OSOutcomeEvent .fromMap (json.cast <String , dynamic >());
340352 }
341353
342354 // Private function that gets called by ObjC/Java
0 commit comments