import 'package:flutter/material.dart'; class ServiceRequestUtils{ static int calculateAndAssignWorkingHours({ required DateTime? startTime, required DateTime? endTime, required TextEditingController workingHoursController, required Function(int) updateModel, // A callback to update the model }) { print('end date i got is ${endTime}'); if (startTime != null && endTime != null) { Duration difference = endTime.difference(startTime); int hours = difference.inHours; // Update the controller and model workingHoursController.text = hours.toString(); updateModel(hours); // Call the function to update the model return hours; } else { return -1; // Indicating invalid input } } }