backWithData method

void backWithData(
  1. T data
)

Navigates back to the previous screen with provided data.

If a valid BuildContext is provided, this method pops the current route and returns the provided data to the previous screen.

Parameters:

  • data: The data to be returned to the previous screen.

Implementation

void backWithData(T data) {
  Navigator.pop(context, data);
}