import 'package:memory_checker/memory_checker.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
...
navigatorObservers: [
LeakObserver()
],
);
}
}
LeakObserver
will notify if there are some leaks found by VMService
Welcome for pr: https://github.com/asjqkkkk/memory_checker/compare
Welcome for issue: https://github.com/asjqkkkk/memory_checker/issues/new
If you meet this error: Bad state: Insecure HTTP is not allowed by platform
you need add some file to solve this problem
This behavior may be omitted following migration guide: https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android.
add in android/app/src/main/AndroidManifest.xml:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="receipt"
android:usesCleartextTraffic="true" <!-- This Line -->
android:icon="@mipmap/ic_launcher">
Allow insecure/HTTP requests globally across your application on iOS, you can add this to your ios/Runner/info.plist under the main dictionary definition:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Be warned that you will need to have an explanation for Apple's review team when enabling this, otherwise your app will get rejected on submission.
(see Bad state: Insecure HTTP is not allowed by platform)
If there is a page leak:
Then tap it:
And you can see the leak retainpath: