2

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Muhammad Touseef
  • 4,357
  • 4
  • 31
  • 75

3 Answers3

5

You have to keep the indents :

  dependencies:
    flutter:
      sdk: flutter
    cupertino_icons: ^0.1.2
    rxdart: ^0.18.0
diegoveloper
  • 93,875
  • 20
  • 236
  • 194
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 does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30445924) – Thira Nov 28 '21 at 08:38
0

this worked for me, make sure you putted the dependencies on

dependencies:  
   flutter:

not

dev_dependencies:
  flutter_test:

if that make sense :/