createOrUpdateDevice method
Create or update device
Implementation
Future<bool?> createOrUpdateDevice({bool active = true}) async {
String? fcmToken = await LaravelNotifyFcm.getFcmToken();
return await network(
request: (api) => api.put("/device", data: {
"is_active": (active == true ? 1 : 0),
"fcm_token": fcmToken,
}),
baseUrl: urlLaravel,
handleSuccess: (response) {
dynamic data = response.data;
if (!(data is Map)) return false;
return data.containsKey('status') && data['status'] == 200;
},
);
}