๋ฐ์ํ ๐ฑMobile/๐ฅFlutter11 [Flutter] ํ๋ฌํฐ http GET, POST ์ฌ์ฉํ๊ธฐ, ์์ฒญ(Request), ์๋ต(Response) project/pubspec.yaml http: 0.12.2 ์ถ๊ฐํ๋ค. dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.3 http: 0.12.2//add dev_dependencies: flutter_test: sdk: flutter Session ์ ์ด๋ฅผ ์ํด ํด๋์ค๋ฅผ ๋ง๋ค๊ณ ๊ทธ ์์์ ํค๋ ์ฟ ํค ๋ฑ ์ ํ , ๋ฆฌ์คํฐ์ค์ ์๋ต์ ๊ฐ ์ํ์ฝ๋์ ๋ฐ๋ผ์ ์ผ๋ฟ์ ๋์ฐ๋ ๋ฑ์ ์์ ๋ถ๊ธฐ๋ฅผ ์ถ๊ฐํ๋ค. Session ํด๋์ค๋ฅผ ์์ฑํ๋ค. impor.. 2023. 7. 4. [Flutter] ๊ฐ๋จํ ์ฑ ๋ง๋ค๊ธฐ (provider pattern, translator(google ๋ฒ์ญ), ChuckNorris(19joke json api), jsontoclass) ChuckNorris ๋ผ๋ 19์ธ ๋๋ด์ ๋์ ธ์ฃผ๋ json api๊ฐ ์์ต๋๋ค. ๊ทธ rest api๋ฅผ ์ฌ์ฉํด์ ํ๋ฉด์ ๋ฟ๋ ค์ง๋ ๊ฐ๋จํ ์ดํ์ ๋ง๋ค์ด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค. ์ฐ์ JSON To Dart Class (JsonToDartClass)๋ฅผ ์ค์นํ์ฌ์ค๋๋ค. ์ด๋ฐ๊ฒ ํ๋ฌ๊ทธ์ธ์ผ๋ก ์๋์ง ๋ชฐ๋๋๋ฐ.. ๋งค์ฐ ์ข์ต๋๋ค!!! ์งฑ์งฑ json ํ์์ dart class ๋ก ๋ฐ๊พธ์ด์ง๋๋ค. ์ํ๋๋๋ก ๋ฐ๊พธ์ด์ง์ง ์์ ์ ์์ง๋ง ๋ช๊ฐ๋ง ์ถ๊ฐํ๋ฉด๋์ ๋ฌด์กฐ๊ฑด ์ด ๋ฐฉ์์ด ์ข์ต๋๋ค. ๋จผ์ provider, http, translator ์ด๋ ๊ฒ 3๊ฐ์ง๋ฅผ ์ถ๊ฐํด์ค๋๋ค. provider ํจํด์ ์ด์ฉํ ๊ฒ์ด๊ณ http๋ก json response๋ฅผ ๋ฐ์๊ฒ์ด๊ณ translator๋ก ์์ด๋ก๋๊ฒ์ ํ๊ธ๋ก ๋ฒ์ญํ ๊ฒ์ ๋๋ค. ํ์ผํธ๋ฆฌ์ ๋๋ค. ์ ๋ ์ฐ์ต์ฅ .. 2021. 1. 8. flutter ํ๋ก๊ทธ๋ ์ค๋ฐ progress bar circle progress bar example flutter ๊ธฐ๋ณธ ProgressBar๋ ๊ตฌ๊ธ๋งํ๋ฉด ์ฝ๊ฒ ์ฐพ์ ์ ์๋ค. ์ ๋๊ฐ์ ๊ฒฝ์ฐ ๋งค์ฐ ๊ฐ๋จํ๋ฐ ์ฌ์ฉํ ๋ Stack์ ๋ฃ์ด์ ๋งจ ์๋จ์ ์์์ฃผ๋ฉด ๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ฐ์ ธ์์ ์ฌ์ฉํ๋ ๊ฒ๋ค์ด ์๋ค. flutter_spinkit ์ ์ฌ์ฉํด๋ณด๋๋ก ํ์. ๋งค์ฐ ์ฝ๊ณ ๋น ๋ฅด๊ฒ ์ ์ฉ ๊ฐ๋ฅํ๋ค. ๋จ์ ํ๋ก๊ทธ๋ ์ค ์ ๋๋ฉ์ด์ ์ธ๋ฐ LIKES๊ฐ ์ด๋ ๊ฒ ๋์ ์ค์ ๋ชฐ๋๋ค. ๋จผ์ pubspec.yaml์ ์ถ๊ฐํด์ฃผ์. dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertin.. 2021. 1. 8. flutter secure storage, ์๋๋ก๊ทธ์ธ, android KeyStore example flutter secure storage๋ฅผ ์ฌ์ฉํ ์๋๋ก๊ทธ์ธ์ ํด๋ณด๋๋ก ํ๊ฒ ๋ค. ๊ณ์ ์ ํ๋๋ง ์ฌ์ฉํ์ง์๊ณ ์ฌ๋ฌ๊ณ์ ์ ์ฌ์ฉํ๋๋ก ํ๊ฒ ๋ค. ๋๋ฒ๊น ์ ๋ง์ด ํด๋ณด์ง ์์๋ค. ๋์ถฉ ์ด๋ฐ ์์ด๋ค ๋ผ๊ณ ๋ง, ์ด๋ ๊ฒ ์ฌ์ฉํ๋ ์์ด๋ผ๋๊ฒ๋ง ๋์ถฉ ๋ณด๊ณ ๋์ด๊ฐ๋ฉด ๋ ๊บผ๊ฐ๋ค. flutter secure storage flutter์์ ๊ฐ ํ๋ซํผ(android, ios)์ ๋ด๋ถ์ ์ฅ์(keychain or keystore)๋ฅผ ์ฌ์ฉํ ์ ์๊ฒ ํด์ฃผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค! iOS์์๋ ์ฌ์ฉํด๋ณด์ง ์์์ง๋ง Keychain์ด๋ผ๋ ๊ฒ์ ์ฌ์ฉํ๊ณ ์๋๊ฒ ๊ฐ๋ค. android keystore๋ ์ฌ์ฉํด๋ณธ์ ์ด ์๋ค. ์๋๋ก์ด๋๋ ๋ฃจํ ํ๊ธฐ ์ฌ์ด ์ด์์ฒด์ ์ฌ์ Shared Preference ๊ฐ์ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์๋ ๋ด๋ถ ์ ์ฅ์๋ค์ ๊ฐ๋จํ ๋ฃจํ ๊ณผ์ ๋ง ๊ฑฐ์ณ๋.. 2021. 1. 7. [Flutter] provider + [Change Notifier] ๋ฅผ ์ฌ์ฉํ Provider Pattern example ์ด๋๊น์ง ๋ค์ํ BLOC ํจํด์ผ๋ก ์ฝ๋๋ฅผ ์์ฑํด๋ณด์๋ค. ํ์ง๋ง BLOC์ ๋ก์ง ๋ถํ ์ ์ํ ๋ค์์ ํด๋์ค ์์ฑ์ผ๋ก ์ธํด ๋ณต์ก์ฑ ๋ฌธ์ ๊ฐ ์๊ธฐ ๋๋ฌธ์ 2019๋ Google์์ ์ ๊ทน ์ถ์ฒํ Provider Pattern์ ์ฌ์ฉํด๋ณด๋๋ก ํ๊ฒ ๋ค. ๊ตฌ๊ธ์์ ๋ง๋ ๊ฒ์ ์๋๊ณ ์ปค๋ฎค๋ํฐ์์ ์ฌ๋ผ์จ๊ฒ์ด๋ผ๋๋ฐ ๊ตฌ๊ธ์์ ์ ๊ทน ์ถ์ฒ์ ํ ๊ฒ์ด๋ผ๊ณ ํ๋ค. ๋ํ BLOC๊ฐ ๋ค์์ ํด๋์ค๋ก ๋ณต์กํ๊ธฐ ๋๋ฌธ์ ์์ ์ฐ์ง ์๋๊ฒ์ ์๋๋ค. ์ด๋์ ๋ ๊ท๋ชจ๊ฐ ์๋ ํ๋ก์ ํธ๋ BLOCํจํด์ ์ฌ์ฉํ์ฌ ์ ํํ ๋ก์ง๋ถ๋ฆฌ๋ฅผ ํ๋๊ฒ์ด ๋ถ๋ช ํ ๋ ์ข์๊ฒ์ผ๋ก ๋ณด์ธ๋ค. ์๊ท๋ชจ์ Provider, ์ค๊ท๋ชจ์ Provider, Bloc, ๋๊ท๋ชจ์ Bloc ๊ฐ ๋ง์ง ์์๊น ์ถ๋ค. ํธ๋ฆฌ์ด๋ค. main.dart import 'package:flutter/founda.. 2021. 1. 6. [Flutter] ๊ธฐ์ด๊ฐ ๋๋ StreamBuilder BLOC ํจํด, StreamSubscription, yield example ์ ๋ฒ์๋ Cubit๋ฅผ ์ฌ์ฉํ์ฌ BLOC ํจํด์ ์ ์ํด๋ณด์๋ค. ํคํ๊ฒ ๋์ ์ ๋ณด์ด๋ Cubit๋ก ํ์ ๋์๋ง ๊น๋ํ๊ฒ ์ต์ ๋น ํ์ง๋ง ์ญ์๋ BLOC๋ ๋ณต์กํ๋ค. ์ด๋ฒ์ ์์ฑํ๋ StreamBuilder๋ฅผ ์ฌ์ฉํ BLOC ํจํด ๋ํ ๋ณต์กํ๋ค. ๊ฒฐ๊ตญ ํ๋์ ๊ธฐ๋ฅ์ ๋ง๋ค๋ ค๋ฉด ํด๋์ค๋ฅผ ์ต์ 3, 4๊ฐ๋ฅผ ๋ง๋ค์ด์ผํ๋ ๋ฌธ์ ์ด๋ค. ํ์ผํธ๋ฆฌ์ด๋ค. ๋ก์ง์ ๋๋๊ณ , ์ด๋ฒคํธ์ ์ํ๋ฅผ ๊ด๋ฆฌํ๋ค. main.dart import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc_with_stream/ticke.. 2021. 1. 6. [Flutter] Cubit๋ฅผ ์ฌ์ฉํ BLOC ํจํด, Bloc.observer example CUBIT๋ฅผ ์ฌ์ฉํ BLOC ํจํด Bloc.observer๋ฅผ BlocObserver๋ฅผ ์์ํ class๋ก ์ด๊ธฐํํด์ onChange๋ฅผ overrideํด์ ์ํ๊ฐ ๋ณํ ๋๋ง๋ค print ํ ๊ฒ์ด๊ณ navigation push ๋ ํด๋ณผ ๊ฒ ์ ๋๋ค. pubspec.yaml dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 bloc: ^6.1.0 //์ถ๊ฐ flutter_bloc: ^6.1.0 //์ถ๊ฐ counter_observer.dart .. 2021. 1. 4. [Flutter] fluro package (navigation ์ด๋, route, transition) sample code fluro ๋ฅผ ์ฌ์ฉํ์ฌ route๋ฅผ ๊ด๋ฆฌํ ์ ์๋ค. arguments ์ ํ๋๊ฒ๋ ๊ฐ๋ฅํ๊ณ transitionType์ ํตํด ์ํ๋ ์ ๋๋ฉ์ด์ ์ ๋ณด์ด๊ฒ, ์๋ณด์ด๊ฒ ํ ์๋ ์๋ค. pub.dev/packages/fluro fluro | Flutter Package Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions. pub.dev code sample ์ด๋ค. import 'package:flutter/material.dart'; import 'package:fluro/fluro.dart'; Handler _TestNativeH.. 2020. 12. 22. [Flutter] flutter intro(splash) -> login page timer sample code flutter_example/widgets ํจํค์ง๋ฅผ ํ๋ ๋ง๋ญ๋๋ค. main.dart import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_example/widgets/introPage.dart'; import 'package:flutter_example/widgets/loginPage.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, ti.. 2020. 10. 26. [Flutter] Flutter ํ๋ซํผ ์ฑ๋์ ์ด์ฉํด์ Android ์ฝ๋ ํธ์ถํ๊ธฐ (MethodChannel) ์์ฑ์ Paltform channel language ์ฒดํฌ ๋ชจ๋ ํด์ ํ๊ธฐ * ํ๋ซํผ ์ฑ๋์ ์ฌ์ฉํ๋๋ฐ ์์ด์ ์ค์ํ๊ฒ์ Platform channel language๋ฅผ ์ด๋ค๊ฒ์ ์ฌ์ฉํ ๊ฒ์ธ์ง์ด๋ค. Include Swift support for iOS code ๋ฅผ ์ ํํ ์ ์ด ์๋๋ฐ Swift ์ฝ๋๋ฅผ ์์ฑํ ์ฌ๋์ด ์์ด์ ๋ญํจ๋ฅผ ๋ณธ ์ ์ด ์๋ค. ํ๋ซํผ ์ฑ๋์ ์ฌ์ฉํ๋ ค๋ฉด java, kotlin, Objective-c, swift ๋ชจ๋ ์์งํด ๋์ด์ผ ํ๋ค. project/lib/main.dart import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class PlatformChannel.. 2020. 10. 25. [Flutter] Flutter ์๋ช ์ฃผ๊ธฐ Sample Code main.dart import 'package:flutter/material.dart'; void main() => runApp(TestApp()); class TestApp extends StatelessWidget { TestApp() { print('TestApp TestApp() start'); print('TestApp TestApp() done'); } @override Widget build(BuildContext context) { print('TestApp build() start'); print('TestApp build() done'); return MaterialApp( title: 'StatefulWidget LifecycleApp', home: _FirstStatefulWidge.. 2020. 10. 25. ์ด์ 1 ๋ค์ ๋ฐ์ํ