플러터에서 base64 문자열을 이미지로 표현하는 방식이다.
String base64 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQYAAADBCAMAAAAace62AAAAyVBMVEX////y8vP7+/v8/Pz29vfQz9FdXV/v7/BPT1D///7X1thKSkvu7u/k5OV+fYBZWVtsbG5jY2V0c3ZBQEKQj5K/vsDo6OnHxsm4t7lHR0g9PT6gn6KamZsAAACqqayUk5eCgoQ4NzixsLQ/ODorKSo0MjMsJyhoZ2kjIB8sJyQzLSs5NDVER0aJiIxVU1Td3N4dGhkXFRIjGholJiM5My8yLycoIRwkIBQcHBY2LjEXFQ4bGRsVFBYiICIeFxRMRUczJSgRDgElLCndRnHNAAAQMklEQVR4nO2d6WKjuJaADQZZFwESEhgQBCMbjDcg6WR6Kl2Vyu15/4canM14S9vY2Tp8f7qLOLI40ll1IJ1OS0tLS0tLS0sj5I+eQEtLy9ugG616dzoaAVErBxdbBKkfPYuPRrMsCxHpo6fxwahWTJCIPnoaH4w8sClitPcGQ3ffYMy3Qs1Njqzyo6fxwfQGtEDwu6uEbmeoAM5X2r5vQYA4t+h3jxk0NrpDpP/R0/hgFHOeJPi7m8dOLApBtI+exUejMcyx/tGz+GhKxhAyPnoWH02fpovJekL1Df2mCgSH9tolJ3S/myD6mZ/CQT2tVE0A2TcLJx0COStqKtENMmDBCT1pVNnQv1K+LgW+BQSrq0RECMTFpXnSuG6Rmc6XEUTPziyL8Vr0KIeVFFJSJMOTBtYDQvn9F6ljKUMICIBj9+WKZFOrwGoOrzbE0B8eF2iXOU595Jxjlm+OlgEC/RlZeYWBBXxqSBZjayGl7MTwyFtSSjKf/fEVDO3QsohjjfjLHSsRhay63T6chPUP9lUTeUd7UMWbzsafPkCXA4yLyGHjF2PYDc1sWYrseiKpq7VKM9RoWaPpdP5OwWkZDJUmvyfnBcxUmY5WCza0Y99cVhyiBK0+qAwAyxrmnvb0z3cqYUSQNDLIQZHBYUdl4/j5yjAIFmh5v2p2vfKgkg0Lv6nJ1+H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xd+A+UrIpaF/qjiupaXlK9H97ja02+loahDS0DO+cXi1fIXp/3EkCoulPP6EpwnvhGRiAdOUc1BkbPRd//6kCnhBHVdV1LAQ82kKvqVm6Gjx3P0p9x1xOfYP7Cf/VyGZENWOmg36U/jZ/o/v4/O1sRyHQRZx/d+yhwn7fklYiAYbCYdmkui75SCSsKokdP1aHsLvth007vQ3m108Gn+Rv/JyLgxaDOHcXi/ZB+bhD/H/O/AQJbPf0bqdjwGVzvHG0q9DZAZ4+udaUqUEBH3CZq03xY3VP6aifkWxLXziS2a/HrphkPFk1cCmGLbA1nfzE51l9+qlYE9vzuvpsY99/M3cxCPuj8XkrxRnJCsEStnsjB0gXwogfk2u04lI/eQa5853CyCf6S4Pu5Mkvf6Z2N8sXthAMUotitxvaBpbWlpaWlrenq9eh21paWlpaWlpaWlpaXl32kTqPfg6Uv46M21paWn50sitvW1paWlpaWlpaWlpaWlpaWlpaWlpaWlp+Xfx/x0QSFYtvZRLAAAAAElFTkSuQmCC';
기존에는
Image.memory(base64Decode(base64))
dart가 업데이트 된 이후인지 몰라도 해당 아래와 같이 코드가 오류가 발생했다.
Invalid character (at character 5)
data:image/png;base64,
아래와 같이 소스를 수정하여 에러를 수정했지만,
Image.memory(Uri.parse(base64).data.contentAsBytes())
일시적인 오류인지 원인은 아직 파악을 하지 못했다.
Flutter 작업을 하면서 이런 저런 문제를 해결 하는 재미도 쏠쏠하다.
'모바일 프로그램 > flutter - 플러터' 카테고리의 다른 글
FLUTTER date picker showDatePicker 사용 및 에러 문제 (0) | 2019.10.10 |
---|---|
Flutter, dart 문자열이 숫자형인지 체크하는 함수 (0) | 2019.10.08 |
플러터(flutter) 기존 프로젝트 가져오기(import) (0) | 2019.08.27 |