Search
▪️

Appendix Two: Building a Dart CLI

Directory.current를 통해 현재 directory 위치를 알 수 있다.
listSync()를 통해 주어진 directory의 모든 파일들을 list로 가져올 수 있다. (타입은 FileSystemEntity)
OS별 directory 구분자를 쓰고 싶다면, Platform.separator로 쓸 수 있다.
FileSystemEntity를 File 타입으로 캐스팅 후, 이미지 파일을 Raw코드로 해독한다. (readAsByteSync) → Image 라이브러리 Function들을 통해 RawImage로 만든다. (decodeImage) → 다른 타입으로 변환한다. (encodePng, encodeJpg) → 변환된 이미지의 바이트 코드를 새로운 파일에 덮어 써야 한다.(writeAsByteSync)
dart:io의 run을 통해서 파일을 열 수 있다.