Flutter comes with tree shaking compilation. Including only the code used.
But this is easily breakable inadvertently.
Is there any way to test and debug tree s
For debugging, it is possible to connect to the Observatory in profile mode. Then inspect the content of desired dart file
You won't see the actual sources in profile mode; but you'll see an overview of what is inside the file, including the defined classes and their methods.
For example, a widget such a the following:
class Home extends StatelessWidget {
_unused() {
print('home');
}
@override
Widget build(BuildContext context) {
return Container();
}
}
when inspected in the Observatory in profile mode; _unused
method will not be in the function list: