Reputation: 791
I'm trying to use this code from Github in my app, but not sure why it shows some errors. A class to use later. It says The LinearGradient has a problem ( "colors, not defined ) but just checked the source code of Flutter and it has this property.
import 'package:flutter/material.dart';
class Palette {
static const Color scaffold = Color(0xFFF0F2F5);
static const Color facebookBlue = Color(0xFF1777F2);
static const Gradient createRoomGradient = LinearGradient(
colors: [Color(0xFF496AE1), Color(0xFFCE48B1)],
);
static const Color online = Color(0xFF4BCB1F);
static const LinearGradient storyGradient = LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.transparent, Colors.black26],
);
}
Upvotes: 1
Views: 2108
Reputation: 61
This solution worked for me: https://github.com/flutter/flutter/issues/67084#issuecomment-702397222
in your pubspec.yml
change this to :
environment: sdk: ">=2.8.0 <3.0.0" and flutter pub get
i'm using android studio, then i invalidate cache and restart, done!
Upvotes: 1
Reputation: 51
The latest Flutter version (1.22.0) is broken, I'd say.
My LinearGradient code worked until 10 minutes ago. Then I updated Flutter. After the update the same errors you see were coming up - no code changes were made.
However, the code still runs, regardless of the non-error, so that's the good news.
Upvotes: 0