Search code examples
androiddartflutterdart-pubflutter-dependencies

rxdart usage in Flutter not being recognized


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.


Solution

  • You have to keep the indents :

      dependencies:
        flutter:
          sdk: flutter
        cupertino_icons: ^0.1.2
        rxdart: ^0.18.0