Update flutter dependencies in /.pub-cache

Disclaimer: By running the command below, have a really fast internet connection or be ready to lose one hour of productive hours. ( it will redownload every package every installed on your pc, and I mean each and all of the versions of each packages)~TSR flutter pub cache repair or delete /Users/xxxxxxx/development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+3/ and run flutter … Read more

Do not use BuildContexts across async gaps

Don’t stock context directly into custom classes, and don’t use context after async if you’re not sure your widget is mounted. Do something like this: class MyCustomClass { const MyCustomClass(); Future<void> myAsyncMethod(BuildContext context, VoidCallback onSuccess) async { await Future.delayed(const Duration(seconds: 2)); onSuccess.call(); } } class MyWidget extends StatefulWidget { @override _MyWidgetState createState() => _MyWidgetState(); } … 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

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 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

How to change status bar color in Flutter?

Update Flutter 2.0 (Recommended): On latest Flutter version, you should use: AppBar( systemOverlayStyle: SystemUiOverlayStyle( // Status bar color statusBarColor: Colors.red, // Status bar brightness (optional) statusBarIconBrightness: Brightness.dark, // For Android (dark icons) statusBarBrightness: Brightness.light, // For iOS (dark icons) ), ) Only Android (more flexibility): import ‘package:flutter/services.dart’; void main() { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( systemNavigationBarColor: Colors.blue, // navigation … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)