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

Flutter use variable created inside Future builder outside of the build method,

I don’t fully understand the reason to have a global TextController (and I don’t think its a good idea either) but using Riverpod it would look somethink like this: import ‘package:flutter/material.dart’; import ‘package:flutter_riverpod/flutter_riverpod.dart’; class AccountData { final String firstName; final String lastName; final String phoneNumber; AccountData({ required this.firstName, required this.lastName, required this.phoneNumber, }); factory AccountData.fromJson(Map<String, … Read more

How to get unique device id in flutter?

Null safe code Use device_info_plus plugin developed by Flutter community. This is how you can get IDs on both platform. In your pubspec.yaml file add this: dependencies: device_info_plus: ^3.2.3 Create a method: Future<String?> _getId() async { var deviceInfo = DeviceInfoPlugin(); if (Platform.isIOS) { // import ‘dart:io’ var iosDeviceInfo = await deviceInfo.iosInfo; return iosDeviceInfo.identifierForVendor; // unique … Read more

Flutter App stuck at “Running Gradle task ‘assembleDebug’… “

Here is solution in my case. Open your flutter Project directory. Change directory to android directory in your flutter project directory cd android clean gradle ./gradlew clean Build gradle ./gradlew build or you can combine both commands with just ./gradlew clean build Now run your flutter project. If you use vscode, press F5. First time … Read more