flutter navigator.pop causing error but pressing back button does not cause error code example
Example: pop and push shows black screen which needs to be pressed back flutter
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SecondActivity()),
);