본문 바로가기
AWS 개발일지/AWS 예제로 사용해보기

3. AWS Amplify 모듈 2 시작하기 (7.7.0-flutter-preview.2)

by 우딬 2022. 8. 22.

1. Amplify CLI 개발자 프리뷰 설치

이제 실제 다운로드하고 설정을 해보나 ~ 하고 있는데

예제 버전이 너무 낮다 낮아..

정말 일을 많이 하고 있다는 것이겠지..?

 

예제는 4.26이지만 내가 다운로드 받은버전은 7.7.0이다

버전이 다르기때문에 설치할때 질문 종류가 더 다양해진거 같다.

 

2. Amplify 초기화

  • 지역 선택 부분 (가까운 서버로 만들면 될거 같다.) 
Specify the AWS Region
? region:  
  eu-west-3 
  eu-central-1 
  ap-northeast-1 
❯ ap-northeast-2 
  ap-southeast-1 
  ap-southeast-2 
  ap-south-1

  • 유저 정보 입력
Specify the username of the new IAM user:
? user name:  # User name for Amplify IAM user
Complete the user creation using the AWS console
Specify the username of the new IAM user:
? user name:  username
Complete the user creation using the AWS console
https://console.aws.amazon.com/iam/home?region=ap-northeast-2#/users$new?step=final&accessKey&userNames=rjsgy0815&permissionType=policies&policies=arn:aws:iam::aws:policy%2FAdministratorAccess
Press Enter to continue

Enter the access key of the newly created user:
? accessKeyId:  발급받은 accessKeyId 
? secretAccessKey:  발급받은 secretAccessKey
This would update/create the AWS Profile in your local machine
? Profile Name:  username

Successfully set up the new user.

 

등록이 성공적으로 끝나면 amplifyconfiguration.dart라는 파일이 생성된다.

꼭꼭 확인하고 다음단계로 넘어가자.

 

3. 프로젝트에 종속성 추가

 

여기에서 오류가 있는데 amplify_core: '<1.0.0'  이거 쓰면 안됩니다.

amplify_flutter: '<1.0.0'

이걸로 사용하셔야 됩니다!

 

https://stackoverflow.com/questions/66353691/the-method-amplify-isnt-defined-for-the-type-myappstate-flutteramplify

 

The method 'Amplify' isn't defined for the type '_MyAppState'. -FlutterAmplify

I've just started learning AWS Amplify and followed the step given in https://aws.amazon.com/getting-started/hands-on/build-flutter-app-amplify/module-two/ to initialize Amplify in my flutter proje...

stackoverflow.com

 

4. 앱에 통합

여기도 수정해야할 코드가 있다.

... // class _MyAppState extends State<MyApp> {

final _amplify = Amplify();

... // final _authService = AuthService();

여기에 ()를 제거 해야한다.

... // class _MyAppState extends State<MyApp> {

final _amplify = Amplify;

... // final _authService = AuthService();

 

3,4에서 수정 한다면 다음으로 넘어갑시다.

댓글