simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
import 'dart:convert';
|
||||
|
||||
/// Decodes the JSON payload of a locally rendered notification; null when
|
||||
/// absent or malformed.
|
||||
Map<String, dynamic>? decodeNotificationPayload(String? payload) {
|
||||
if (payload == null || payload.isEmpty) return null;
|
||||
try {
|
||||
return jsonDecode(payload) as Map<String, dynamic>;
|
||||
} on Object {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// Where a tapped notification leads.
|
||||
sealed class PushTarget {
|
||||
const PushTarget();
|
||||
|
||||
Reference in New Issue
Block a user