강의

멘토링

커뮤니티

Inflearn Community Q&A

larosetapark4986's profile image
larosetapark4986

asked

[Code Factory] [Beginner] Flutter 3.0 App Development - Escape Beginner Status Today with 10 Projects!

(랜덤숫자) backgroundColor: PRIMARY_COLOR 오류

Written on

·

420

·

Edited

0

 

color.dart에

import 'package:flutter/material.dart';

const Color PRIMARY_COLOR = Color(0xFF2D2D33);
const Color RED_COLOR = Color(0xFFEA4955);
const Color BLUE_COLOR = Color(0xFF549FBF);

한 뒤에

return Scaffold(
  backgroundColor: PRIMARY_COLOR,
  body: SafeArea(

라고 backgroundColor: PRIMARY_COLOR,

넣자마자 오류가 납니다..

자동완성도 당연히 안되고요.

아무리 봐도 똑같이 했는데 이유를 모르겠어서요ㅜ

 

Performing hot restart...
Syncing files to device SM G991N...
lib/screen/home_screen.dart:14:24: Error: The getter 'PRIMARY_COLOR' isn't defined for the class '_HomeScreenState'.
 - '_HomeScreenState' is from 'package:random_number/screen/home_screen.dart' ('lib/screen/home_screen.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'PRIMARY_COLOR'.
      backgroundColor: PRIMARY_COLOR,
                       ^^^^^^^^^^^^^
Restarted application in 561ms.
flutter클론코딩

Answer 2

0

해결되었습니다 감사합니다

0

codefactory님의 프로필 이미지
codefactory
Instructor

안녕하세요!

PRIMARY_COLOR isn't defined -> PRIMARY_COLOR는 정의되지 않았다.

불러오기를 잊으신 것 같습니다.

import '색상 정의한 파일 경로';

위 코드를 추가해서 PRIMARY_COLOR 변수를 불러오기 해주세요.

감사합니다!

larosetapark4986's profile image
larosetapark4986

asked

Ask a question