how to use local flutter package in another flutter application?

Find this file in your flutter application => pubspec.yaml Use local dependency dependencies: flutter: sdk: flutter my_new_package: path: ./my_new_package Note: The ./my_new_package above means that the my_new_package directory containing the pubspec.yaml for the package is a sub-directory of the app. If you have the package as a directory at the same level as the app, … Read more

Colon : in Dart constructor syntax

This feature in Dart is called “initializer list”. It allows you to initialize fields of your class, make assertions and call the super constructor. This means that it is not the same as the constructor body. As I said, you can only initialize variables and only access static members. You cannot call any (non-static) methods. … Read more

Implement an Observer pattern in Dart

Here’s a way to do it using the Observe package. The example is taken from code comments in that package (and adapted to your example above). Essentially, you annotate fields you want to be observable with the @observable annotation, and then listen for changes (which you trigger with the call to Observable.dirtyCheck(); First, add the … Read more

Invalid Arabic characters With Utf-8 charset Retrived with http.get Flutter

The web server’s Content-Type header is Content-Type: text/html. Note that isn’t including a charset suffix. It should be saying Content-Type: text/html; charset=utf-8. The package:http client looks for this charset when asked to decode to characters. If it’s missing it defaults to LATIN1 (not utf-8). As you’ve seen, setting the headers on the Request doesn’t help, … Read more

How to use InputFormatter on Flutter TextField?

Formatters In the services library you will find the TextInputFormatter abstract class (this means that you have to import package:flutter/services.dart). It already has implementations, which are FilteringTextInputFormatter (formerly BlacklistingTextInputFormatter and WhitelistingTextInputFormatter) and LengthLimitingTextInputFormatter. If you want to implement your own formatter, you can do so by extending TextInputFormatter itself and implementing formatEditUpdate in there. I … Read more