If you want to read the code, you can always unzip a widget and read the source code.
You can find the widget in your project directory, right click, extract / unzip to a location and voila you can read the code.
If you want to debug a widget running in an app, it's easier when you have the app running locally. You can run the chrome inspector and find the widget code in sources tab under your app domain > widgets. You can add breakpoints there and inspect the working. For native apps, see if this helps : https://docs.mendix.com/howto/mobile/native-debug