import 'package:cheminova/models/notification_model.dart'; import 'package:cheminova/utils/api_urls.dart'; import '../utils/common_api_service.dart'; class NotificationApiService { Future?> getNotification(String token) async { try { String url =ApiUrls.getNotificationUrl; // Base URL to fetch product manuals final response = await commonApiService>( method: "GET", url: url, additionalHeaders: { // Pass the token here 'Authorization': 'Bearer $token', }, fromJson: (json) { if (json['notifications'] != null) { // Map the list of product manuals from the response final List notification = (json['notifications'] as List) .map((manualJson) => NotificationModel.fromJson(manualJson as Map)) .toList(); return notification; } else { return []; } }, ); return response; } catch (e) { print(e.toString()); return null; } } }