rxdart usage in Flutter not being recognized
1,459
You have to keep the indents :
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
rxdart: ^0.18.0
Author by
Muhammad Touseef
Microsoft Student Partner and passionate uwp and mobile developer.
Updated on December 06, 2022Comments
-
Muhammad Touseef over 1 year
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.
-
diegoveloper over 5 yearsdo you have any error after execute 'flutter packages get' ?
-
ibhavikmakwana over 5 yearswhat's the error?
-
Muhammad Touseef over 5 years@diegoveloper no I did not get any error after "flutter packages get" I got exit code 0, which I guess means it ran succesfully. error is get is "target of URI doesnt exist 'package:rxdart/rxdart.dart'".
-
Dinesh Balasubramanian over 5 yearsI cloned your repo and imported 'package:rxdart/rxdart.dart' and it is working fine. What is the version of flutter/dart ?
-
Muhammad Touseef over 5 years0.5.1 flutter and 2.0 dart
-
-
Rémi Rousselet over 5 yearsa few seconds more and I would have said the same. :p
-
diegoveloper over 5 yearshaha but it's weird because if you don't you use indents you get an error on the console
-
Muhammad Touseef over 5 yearssorry the indents in my questions were misleading I have corrected them now. indents are alright in my file and that is why flutter packages get is running fine.
-
diegoveloper over 5 yearsmaybe you could attach a screenshot with the error message and the class where you are using it
-
Muhammad Touseef over 5 yearsplease see the update part of the question. @diegoveloper
-
diegoveloper over 5 yearsyou are using an old version : rxdart: ^0.16.7
-
Muhammad Touseef over 5 yearsalso tried the latest version 0.18.1 still got the same error
-
diegoveloper over 5 yearscould you add a screenshot , put the mouse over the error line and take screenshot?
-
Muhammad Touseef over 5 yearsguyx thanks for all the help but I just restarted the IDE and that solved the problem for me strangely. and I accepted the answer because indentation can also cause this problem so it may help somebody else as well :)
-
Thira over 2 yearsThis does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review