Call to a member function getUri() on null - Twig + Slim 3

I’m new to slim framework. In app.php file if i comment the addExtension line home.twig page is showing otherwise it’s giving me the following error. please help me to rectify this error.

Please find the below code in the link


Thank you

Sorry guys i found my mistake.

I’m forgot to pass the $container parameter in the $container [‘view’] function.