Solution 1 :
You should also add flutter_bloc package to the pubspec.yaml file which makes it easy to use blocs and cubits.
and then run flutter pub get
to get the package.
Problem :
I created a brand new flutter project, I added bloc: ^8.0.3
and equatable: ^2.0.3
to pubspec.yaml
file, I just imported import 'package:flutter_bloc/flutter_bloc.dart';
in the main file, and it gives me the above error Target of URI doesn't exist: 'package:flutter_bloc/flutter_bloc.dart'.
I added a cubit file and imported import 'package:bloc/bloc.dart';
and no problem happened after importing, I can summarize that 'package:bloc'
and 'flutter'
exist, but the 'flutter_bloc'
not exist, and don’t know why, even I tried a lot of solutions like deleting pubspec.lock
and .packages
and run command flutter pub get
, and disable include: package:flutter_lints/flutter.yaml
, but the problem not solved
Comments
Comment posted by mohamed.oussous
you need to add flutter_bloc, in terminal run flutter pub add flutter_bloc