When I run the project I get an error like this, flutter clean and then flutter pub get tried but no result. Thanks for read, please help..
==>
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.0/lib/get_connect/http/src/http.dart:60:11: Error: No named parameter with the name 'findProxy'.
findProxy: findProxy,
^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.0/lib/get_connect/http/src/http/html/http_request_html.dart:13:3: Context: Found this candidate, but the arguments don't match.
HttpRequestImpl({
^^^^^^^^^^^^^^^
Most probably, this is caused because the package is not compatible with the current version of flutter or vice versa.
Try updating the package version from:
https://pub.dev/packages/http
Also, try importing the package using following command:
import 'package:http/http.dart' as http;
and then use functions as follows:
http.post()
Related
I'm new to flutter and I'm getting the above error:
Unused import: package:english_words/english_words.dart
I don't understand why I am getting an error.
What should I do?
This is referring you didn't use the package. You can remove the import (line 1) if you dont use the package on this file. Or you can ignore it for now.
You can find more about linter-rules and flutter_lints.
I am getting an error called "Undefined name 'Provider' in flutter. Here is the code snippet for it:
addData() async {
UserProvider _userProvider = Provider.of(context, listen : false);
await _userProvider.refreshUser();}
Can someone help me figure this out?
You need to import the provider package on the current page
import 'package:provider/provider.dart';
Provider is a powerful State Management package which has to be added to the project and imported in order to use it.
If you haven't added the package, then add it by the following command in the project folder in Terminal/Command Prompt:
flutter pub add provider
Then in the file containing the snippet, import the package at the top like the following:
import 'package:provider/provider.dart';
Check if you have following dependency added in your pubspec.yaml file
dependencies:
provider: ^6.0.3
If not add it or simply run in your terminal
flutter pub add provider
After getting your dependency import the provider package in your page:
import 'package:provider/provider.dart';
I have been developing application and one of the libraries I have used was Flutter Redux Navigation. Everything was working fine, until recently, when I started getting following error
../../lib/src/navigation_middleware.dart:3:1: Error: 'NavigationDestination' is imported from both 'package:flutter/src/material/navigation_bar.dart' and 'package:flutter_redux_navigation/src/navigation_destination.dart'.
import 'package:flutter_redux_navigation/src/navigation_destination.dart';
^^^^^^^^^^^^^^^^^^^^^
../../lib/src/navigation_middleware.dart:35:26: Error: 'NavigationDestination' is imported from both 'package:flutter/src/material/navigation_bar.dart' and 'package:flutter_redux_navigation/src/navigation_destination.dart'.
this._setState(NavigationDestination(
^^^^^^^^^^^^^^^^^^^^^
../../lib/src/navigation_middleware.dart:55:26: Error: 'NavigationDestination' is imported from both 'package:flutter/src/material/navigation_bar.dart' and 'package:flutter_redux_navigation/src/navigation_destination.dart'.
this._setState(NavigationDestination(
I even tried to copy example project from their git, and got exactly same error. This is something in library, or perhaps some settings of my IDE? Please let me know if anyone encountered this error.
The problem was that I have upgraded Flutter version from 2.5.1 to 2.8.0. The newest Flutter version contains upgraded Material library, which contains the method called NavigationDestination. Thus both, the library and Material design have the same name of the class, of course, resulting in error.
Can't run my flutter web app when blue_thermal_printer package is being used.
Compiler show these errors:
import 'package:blue_thermal_printer/';
^
/D:/All%20Data/Softwares/Latest%20Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/blue_thermal_printer-1.1.8/lib/blue_thermal_printer.dart:189:23:
Error: Type 'Registrar' not found.
static registerWith(Registrar value){
^^^^^^^^^
lib/generated_plugin_registrant.dart:31:3: Error: Getter not found: 'BlueThermalPrinterPlugin'.
BlueThermalPrinterPlugin.registerWith(registrar);
What I have tried until now:
1- Tried to enable flutter web support with this command: flutter create .
2- Tried to create a new class BlueThermalPrinterPlugin in the package file blue_thermal_printer.dart with the following method:
class BlueThermalPrinterPlugin{
static var nameoo ;
static registerWith(Registrar value){
this.nameoo=value;
return nameoo;
}
}
But that doesn't either helps because sdk generated automatic generated_plugin_registrant.dart which produces incomplete import i.e import 'package:blue_thermal_printer/'; causing compile time issue.
I need to run my flutter app on web which was working fine a few days before.
Thanks to the developer of this package whom I contacted personally and he corrected the error in packge. blue_thermal_printer 1.2.0 is working fine and doesn't contain this error anymore.
I have added myfatoorah_flutter package version 1.0.7 and in file I have imported the package as import 'package:myfatoorah_flutter/myfatoorah_flutter.dart'; it fails the build and gives the following error
../../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/myfatoorah_flutter-1.0.7/lib/myfatoorah_flutter.dart:609:31: Error: The argument type 'bool Function(bool)' can't be assigned to the parameter type 'bool Function(bool, RouteInfo)'.
- 'RouteInfo' is from 'package:back_button_interceptor/src/back_button_interceptor.dart'
('../../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/back_button_interceptor-4.3.1/lib/src/back_button_interceptor.dart').
BackButtonInterceptor.add(myInterceptor);
I have tried following solutions and none of them worked:
changed version of myfatoorah_flutter
switched between channels dev/stable
upgraded flutter sdk
settings.gradle removed and added again
when I remove import line, it works fine, help is required so that I can integrate the payment methods
I am also getting the same error as I tried this way and worked for me.
change version of back_button_interceptor to back_button_interceptor: 4.0.2 in myfatoorah_flutter's pubspec.ymal.