Flutter app slow

debug mode launch is slow blink when launch app size big. because debug mode with Hot reloads. when you create release apk https://flutter.io/docs/deployment/android you can find fast launch no blink during the launch app size small (but bigger than the normal android app) EDIT https://flutter.io/docs/testing/ui-performance#debug-flags Debug mode enables additional checks (such as asserts) that don’t …

Read more

how can we use superscript and subscript text in flutter Text or RichText

You need to use Unicode. Here is the Unicode got from this answer: unicode_map = { # superscript subscript ‘0’ : (‘\u2070’, ‘\u2080’ ), ‘1’ : (‘\u00B9’, ‘\u2081’ ), ‘2’ : (‘\u00B2’, ‘\u2082’ ), ‘3’ : (‘\u00B3’, ‘\u2083’ ), ‘4’ : (‘\u2074’, ‘\u2084’ ), ‘5’ : (‘\u2075’, ‘\u2085’ ), ‘6’ : (‘\u2076’, ‘\u2086’ ), ‘7’ …

Read more

What’s the difference between pub dependencies and dev_dependencies?

dev_dependencies are dependencies that are not available for code in the resulting application, but only for tests, examples, tools, or to add executable tools like for code generation to your project. dev_dependencies of any dependencies in your project (dependencies or dev_dependencies) are always ignored when you publish to pub.dev. See also https://dart.dev/tools/pub/pubspec

How to get widget’s absolute coordinates on a screen in Flutter?

You can use this extension I wrote (requires Dart 2.6): extension GlobalKeyExtension on GlobalKey { Rect? get globalPaintBounds { final renderObject = currentContext?.findRenderObject(); final translation = renderObject?.getTransformTo(null).getTranslation(); if (translation != null && renderObject?.paintBounds != null) { final offset = Offset(translation.x, translation.y); return renderObject!.paintBounds.shift(offset); } else { return null; } } } Example how to use …

Read more

How to read and write a text file in Flutter

Setup Add the following plugin in pubspec.yaml: dependencies: path_provider: ^1.6.27 Update the version number to whatever is current. And import it in your code. import ‘package:path_provider/path_provider.dart’; You also have to import dart:io to use the File class. import ‘dart:io’; Writing to a text file _write(String text) async { final Directory directory = await getApplicationDocumentsDirectory(); final …

Read more

Cancel stream onData

The issue is that I can’t access the variable subscription in the body of my callback, since it is still not created at the time That’s correct – you cannot access is the subscription variable, even if you know that the subscription itself would exist. Dart doesn’t allow variables declarations to refer to themselves. That’s …

Read more