rxdart usage in Flutter not being recognized - android

I am trying to use rxdart package for the first time in my Flutter app and I have added the package in yaml file, then I saved it and vscode automatically ran flutter packages get on project after that complete I tried to import the package with following line
import 'package:rxdart/rxdart.dart';
but the compiler doesn't recognize rxdart within the packages. which is causing the error in the app.
The following are my dependencies of pubspec.yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
rxdart: ^0.18.0
dev_dependencies:
flutter_test:
sdk: flutter
Update
Here is the repo for the project I am working on: https://www.github.com/touseefbsb/LoginStateful
You have to open the folder login_stateful_bloc and the error is in bloc.dart file where I am trying to import it.

You have to keep the indents :
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
rxdart: ^0.18.0

I was having the same issue. Even after pub get, it didn't work. Then I simply restarted my IDE(Android Studio) and now it works.

this worked for me, make sure you putted the dependencies on
dependencies:
flutter:
not
dev_dependencies:
flutter_test:
if that make sense :/

Related

Running Gradle task 'assembleDebug'. (This is taking an unexpectedly long time.)

when I created a very basic flutter app and ran it for the first time, it works perfectly, and when I try to add some dependencies in my pubspec.yaml file I get no errors in my project but when I run the app by 'flutter run' I get stuck in
Running Gradle task 'assembleDebug'...
(This is taking an unexpectedly long time.)
and the app has never worked
this is my pubspec.yaml file
name: myPDFApp
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
syncfusion_flutter_pdfviewer: ^18.4.35-beta // this is the dep that I want to add
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
Add an earlier version of the dependencies, and run pub get. This could solve the issue

Can't run the flutter app after added firebase-core and auth to the project

Here's the error in console, plus flutter doctor didn't showed any error. I've tried upgraded the android sdk to 28, check build.gradle. It still don't work and I have no clue.
Error
Pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
google_fonts: ^1.1.1
path_provider: ^1.6.24
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
1- Move them to dependencies
2- Leave a space at the beggining of the dependencie name like so:
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.5.1
firebase_auth: ^0.18.2
google_fonts: ^1.1.0
provider: ^4.3.2+2
If you realize, it's like if flutter and the rest of your dependencies were at the same level
Its AAPT issue;
Open this open C:\Users\user\Desktop\Projects\Flutter\eLesson\android\app\src\main\AndroidManifest.xml and remove style/Theme.AppCompat.Light.NoActionBar
and
your App or some of you plugin is not compatible to AndroidX. Open android folder of your project in separate Android Studio. Right click on Project->Refactor->Migrate to AndroidX.
Repeat this process for each of your plugin folder.
Clean and Rebuild.
Enjoy.

Project with path 'sdk' could not be found in project 'projectName'

I wrote a Tappay plugin, but I failed to use it.
Please help me, thanks a lot!!
https://pub.dev/packages/tappayflutter
Here's my android error message
Here's my xcode error message
Here's my pubspec.yaml
description: A Flutter framework builded by Tung.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.0+4
share: ^0.6.3+6
tappayflutter: ^0.0.7
flutter_tappay: ^0.3.0+2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
inside you root dir of project create local.properties file inside it put your sdk path like this :
sdk.dir=/Users/tusharpandey/Library/Android/sdk

why http.dart file shows empty when redirecting from import line after adding dependency , also http.get(url) method is undfined

i am a newbie in flutter, actually i am importing http.dart file after adding dependency "http: ^0.12.0" in pubspec.yaml , but as soon as i started importing http.dart file in main.dart and redirect to http.dart file , it shows empty there also the http.get(url) is unrecognized.
thats how i am importing http.dart file :-
import 'package:flutter/http/http.dart' as http;
and this is my pubspec.yaml:-
---
cupertino_icons: ^0.1.2
dependencies:
flutter:
sdk: flutter
description: "A new Flutter application."
dev_dependencies:
flutter_test:
sdk: flutter
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
flutter:
uses-material-design: true
name: flutter_app
shared_preferences: ^0.2.0
version: 1.0.0+1
any help would be appreciated, thanks in advance!
This is how you should import
import 'package:http/http.dart' as http;
This is how your pubspec.yaml be:
dependencies:
flutter:
sdk: flutter
http: any
Run $flutter upgrade to get latest flutter sdk

built_value has a dependency conflict with flutter_test

I'm trying to fetch JSON data using built_value serializer but after setting built_value package in yaml file getting an error like:
Because built_value_generator >=5.5.3 depends on analyzer ^0.32.1 and
every version of flutter_test from sdk depends on analyzer
0.31.2-alpha.2, built_value_generator >=5.5.3 is incompatible with flutter_test from sdk. So, because tornado_blog_flutter depends on
both flutter_test any from sdk and built_value_generator ^5.5.3,
version solving failed. pub get failed
How to solve this error?
My yaml file:
name: flutter_layout
description: A new Flutter application.
dependencies:
flutter:
sdk: flutter
built_collection: '>=2.0.0 <4.0.0'
built_value: ^5.5.3
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
json_serializable: ^0.5.0
build_runner: ^0.9.0
built_value_generator: ^5.5.3
There's some info on this issue here. The version of analyzer used by Flutter needs to be upgraded to solve this.
There's an open issue in Flutter to this here but it doesn't seem to have been done yet.
As a workaround, you could try going back to an earlier version of built_value that doesn't require such a new version of the analyzer.

Categories

Resources