backWithData method

void backWithData(
  1. T data
)

Navigates back to the previous screen with provided data.

data is the data to return to the previous screen.

Implementation

void backWithData(T data) {
  try {
    if (context != null) {
      Navigator.pop(context!, data);
    } else if (navigatorKey != null) {
      navigatorKey!.currentState!.pop(data);
    }
  } catch (e) {
    print('Error in backWithData: $e');
  }
}