Importing the bloc package is not working

Viewed 332

I am trying to import the bloc package so that I can create a cubit

import 'package:meta/meta.dart';
import 'package:bloc/bloc.dart';
part 'counter_state.dart';

class CounterCubit extends Cubit<CounterState> {
 CounterCubit() : super(CounterInitial());
}

but it shows me an error on the bloc package, implying that the package does not exist. I have got the bloc package in my pubspec.yaml file

name: rand
description: A new Flutter project.

publish_to: 'none' 

version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  
  cupertino_icons: ^1.0.2
  flutter_bloc: ^7.1.0
  bloc: ^7.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

I have got the latest version of the bloc but the Cubit still is not working image showing the bloc package error

image showing warning once I put the cursor on the cubit

please someone help me out, this is really giving hard time

0 Answers
Related