So, I am a newbie at flutter. I switced to flutter beta channel and used flutter upgrade.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Netflix UI',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Scaffold(),
);
}
}
So the package here isn't recognized. It worked first time. But due to an unfortunate accident my files got erased and that I want to rebuild it, I can't because the imports are not recognized. I have restarted android studio for three times now and even restarted my laptop. I have a deadline to meet. Please, someone help. TT
Make sure that you have Flutter listed in your dependencies in pubspec.yaml
like this:
dependencies:
flutter:
sdk: flutter
And also ensure you've fetched packages (using flutter pub get
or the button that appears when you have the pubspec.yaml
file open).
Hey Rafia!
First Add dependency then hit -pub get
after that go to your main.dart
and import the package.
it would work!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.