<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.2">Jekyll</generator><link href="https://namikng.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://namikng.github.io/" rel="alternate" type="text/html" /><updated>2023-01-13T09:06:13+00:00</updated><id>https://namikng.github.io/feed.xml</id><title type="html">Nami</title><subtitle>Flutter💙</subtitle><entry><title type="html">도대체 ?.은 왜 붙이라는걸까? - Sound null safety</title><link href="https://namikng.github.io/2023/01/10/%EB%8F%84%EB%8C%80%EC%B2%B4-.-%EB%8A%94-%EC%99%9C-%EB%B6%99%EC%9D%B4%EB%8A%94-%EA%B1%B8%EA%B9%8C" rel="alternate" type="text/html" title="도대체 ?.은 왜 붙이라는걸까? - Sound null safety" /><published>2023-01-10T00:00:00+00:00</published><updated>2023-01-13T00:00:00+00:00</updated><id>https://namikng.github.io/2023/01/10/%EB%8F%84%EB%8C%80%EC%B2%B4-?.-%EB%8A%94-%EC%99%9C-%EB%B6%99%EC%9D%B4%EB%8A%94-%EA%B1%B8%EA%B9%8C</id><content type="html" xml:base="https://namikng.github.io/2023/01/10/%EB%8F%84%EB%8C%80%EC%B2%B4-.-%EB%8A%94-%EC%99%9C-%EB%B6%99%EC%9D%B4%EB%8A%94-%EA%B1%B8%EA%B9%8C">&lt;p&gt;2023 새해가 밝았다. Happy New Year!&lt;/p&gt;

&lt;p&gt;새해 첫 포스팅이다😀&lt;/p&gt;

&lt;p&gt;Flutter in Action 책을 보며 공부중인데&lt;/p&gt;

&lt;p&gt;예제가 너무 예전 버전의 Flutter로 제작되어 있어&lt;/p&gt;

&lt;p&gt;빨간줄을 일일히 처리하던 중 굉장히 많이 하던 작업…&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;는-왜-붙이는건데&quot;&gt;&lt;strong&gt;?는 왜 붙이는건데?&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;이걸 알려면 먼저 Dart의 &lt;strong&gt;Sound null safety&lt;/strong&gt;부터 이해해야 한다.&lt;/p&gt;

&lt;p&gt;아래는 &lt;a href=&quot;https://dart.dev/null-safety&quot;&gt;Dart 공식 홈페이지&lt;/a&gt; 설명을 내 식대로 풀어본 것이다.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Null safety는 변수가 의도하지 않았을때 null이 되어 발생하는 에러를 방지한다.
예를 들어, 만약 메소드가 int 타입을 기대했는데 null을 받았다면, 앱은 runtime 에러를
발생시키게 된다. 이러한 타입의 에러는 디버그 하기가 어렵다.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;위와 같은 이유로, dart는 Nullable(null이 될 수 있는)과 Non-nullable(null이 될 수 없는) 타입을 구분하기로 했다!
 만약 어떤 이유로 변수가 null 값을 가질 수 있게 하려면 물음표 마크(?)를 타입 이름 뒤에 붙여주기만 하면 된다.
예를 들어 &lt;strong&gt;String?&lt;/strong&gt; 이란 타입의 변수는 문자열을 가지거나 혹은 null이 될 수 있다!&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;그러면-는-왜-붙이라는건데&quot;&gt;그러면… &lt;strong&gt;?.는 왜 붙이라는건데?&lt;/strong&gt;&lt;/h2&gt;

&lt;div class=&quot;language-dart highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fromResponse&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;userAge&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;위와 같이 많이들 작성하는데 null 인지 연산자(?.)를 사용하면&lt;/p&gt;

&lt;p&gt;다음과 같이 변경할 수 있다.&lt;/p&gt;

&lt;div class=&quot;language-dart highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;fromResponse&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;userAge&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;‘user 객체가 null이 아니면 user.age를 userAge에 할당하고&lt;/p&gt;

&lt;p&gt;null이면 오류를 발생시키지 말고 null을 할당하시오’ 라는 의미다.&lt;/p&gt;

&lt;p&gt;즉, ?가 붙은 nullable 타입인데 값이 null인지 아닌지 모르겠다?&lt;/p&gt;

&lt;p&gt;그러면 ?.를 사용해서 Exception으로부터 안전하게 하자.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;dart-null-safety-codelab-의-보너스-팁&quot;&gt;&lt;a href=&quot;https://dart.dev/null-safety&quot;&gt;Dart Null safety codelab&lt;/a&gt; 의 보너스 팁!&lt;/h3&gt;

&lt;p&gt;?.을 사용해 메소드를 실행시키면?&lt;/p&gt;

&lt;div class=&quot;language-dart highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// nullableObject가 null이 아닌 경우에만 action 메소드를 실행하게 된다!&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;nullableObject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;codelab 설명도 쉽게 되어 있고 따라해 볼 수 있는 예제가 있어 넘 좋다💙&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><author><name></name></author><category term="개발" /><category term="Flutter" /><summary type="html">2023 새해가 밝았다. Happy New Year!</summary></entry><entry><title type="html">Validate가 필요할땐 Form</title><link href="https://namikng.github.io/2022/12/20/Validate%EA%B0%80-%ED%95%84%EC%9A%94%ED%95%A0%EB%95%90-TextFormField" rel="alternate" type="text/html" title="Validate가 필요할땐 Form" /><published>2022-12-20T00:00:00+00:00</published><updated>2022-12-20T00:00:00+00:00</updated><id>https://namikng.github.io/2022/12/20/Validate%EA%B0%80-%ED%95%84%EC%9A%94%ED%95%A0%EB%95%90-TextFormField</id><content type="html" xml:base="https://namikng.github.io/2022/12/20/Validate%EA%B0%80-%ED%95%84%EC%9A%94%ED%95%A0%EB%95%90-TextFormField">&lt;p&gt;간단한 회원가입 페이지를 만들 일이 있었다. 그리고 나는 익숙한 TextField를 사용했다.&lt;/p&gt;

&lt;p&gt;그런데 Flutter in Action 책을 읽다가 사용자의 입력값을 Validate 해야하는 필드가 여러개 있다면&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TextFormField&lt;/strong&gt;를 사용하는게 편하다는 것을 알게 되어 정리해본다!&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;단순한-textfield-대신-form을-사용하면-좋은-점&quot;&gt;단순한 TextField 대신 Form을 사용하면 좋은 점?&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;모든 필드값을 한번에 처리할 수 있다.&lt;/li&gt;
  &lt;li&gt;validate 후 에러 메시지 처리가 간단하다.&lt;/li&gt;
  &lt;li&gt;validate 할 때 레이아웃 처리를 알아서 예쁘게 해준다.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;https://namikng.github.io/assets/images/textFormField.gif&quot; alt=&quot;스크린샷&quot; /&gt;&lt;/p&gt;

&lt;p&gt;valid, invalid 경우 각각의 UI를 알아서 애니메이션까지 예쁘게 해준다!&lt;/p&gt;

&lt;p&gt;에러 메시지도 그냥 입력만 하면됨&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;기억할-점️&quot;&gt;기억할 점❗️&lt;/h2&gt;
&lt;p&gt;그냥 TextFormField만 사용해도 validate는 되지만 그 입력값을 받아오려면&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GlobalKey, Form&lt;/strong&gt; 위젯이 필요하다.&lt;/p&gt;

&lt;p&gt;코드를 보자!&lt;/p&gt;

&lt;div class=&quot;language-dart highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;_MyHomePageState&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;State&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MyHomePage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// GlobalKey 선언 =&amp;gt; Form의 현재 상태를 관리하는데 사용한다!&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_formKey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GlobalKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FormState&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;();&lt;/span&gt;

  &lt;span class=&quot;nd&quot;&gt;@override&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;Widget&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BuildContext&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Form으로 감싸주고 formkey 할당&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// -&amp;gt; 키를 이용해 Form의 모든 자식 위젯에서 Form의 상태에 접근할 수 있음&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;nl&quot;&gt;key:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_formKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nl&quot;&gt;child:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Scaffold&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;appBar:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AppBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
          &lt;span class=&quot;nl&quot;&gt;title:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'TextFormField 연습해볼까?'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;body:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Center&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
          &lt;span class=&quot;nl&quot;&gt;child:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Padding&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;nl&quot;&gt;padding:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;EdgeInsets&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;20.0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;nl&quot;&gt;child:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Column&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
              &lt;span class=&quot;nl&quot;&gt;mainAxisAlignment:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MainAxisAlignment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
              &lt;span class=&quot;nl&quot;&gt;children:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Widget&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;[&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;TextFormField&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
                  &lt;span class=&quot;nl&quot;&gt;decoration:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InputDecoration&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
                    &lt;span class=&quot;nl&quot;&gt;labelText:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'이메일'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
                  &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
                  &lt;span class=&quot;c1&quot;&gt;// 이 모드를 설정해주어야 실시간으로 validate 에러 메시지를 보여준다!&lt;/span&gt;
                  &lt;span class=&quot;nl&quot;&gt;autovalidateMode:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AutovalidateMode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;always&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
                  &lt;span class=&quot;nl&quot;&gt;validator:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isEmpty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'이메일을 입력해주세요.'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
                    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
                    &lt;span class=&quot;c1&quot;&gt;// 이 부분이 valid한 경우&lt;/span&gt;
                    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
                  &lt;span class=&quot;o&quot;&gt;},&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;......&lt;/span&gt;
              &lt;span class=&quot;o&quot;&gt;],&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;floatingActionButton:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FloatingActionButton&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
          &lt;span class=&quot;nl&quot;&gt;onPressed:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// 이렇게 FormKey를 이용해 한번에 편리하게 validate 가능!&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_formKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;currentState&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;validate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
              &lt;span class=&quot;n&quot;&gt;ScaffoldMessenger&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;showSnackBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
                &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SnackBar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
                  &lt;span class=&quot;nl&quot;&gt;content:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'가입 완료!'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
              &lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
          &lt;span class=&quot;o&quot;&gt;},&lt;/span&gt;
          &lt;span class=&quot;nl&quot;&gt;tooltip:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'가입하기'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;nl&quot;&gt;child:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Icon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Icons&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><author><name></name></author><category term="개발" /><category term="Flutter" /><summary type="html">간단한 회원가입 페이지를 만들 일이 있었다. 그리고 나는 익숙한 TextField를 사용했다.</summary></entry><entry><title type="html">release build 때만 통신이 안된다면</title><link href="https://namikng.github.io/2022/12/12/release-build-%EB%95%8C%EB%A7%8C-%ED%86%B5%EC%8B%A0%EC%9D%B4-%EC%95%88%EB%90%9C%EB%8B%A4%EB%A9%B4" rel="alternate" type="text/html" title="release build 때만 통신이 안된다면" /><published>2022-12-12T00:00:00+00:00</published><updated>2022-12-12T00:00:00+00:00</updated><id>https://namikng.github.io/2022/12/12/release%20build%20%EB%95%8C%EB%A7%8C%20%ED%86%B5%EC%8B%A0%EC%9D%B4%20%EC%95%88%EB%90%9C%EB%8B%A4%EB%A9%B4</id><content type="html" xml:base="https://namikng.github.io/2022/12/12/release-build-%EB%95%8C%EB%A7%8C-%ED%86%B5%EC%8B%A0%EC%9D%B4-%EC%95%88%EB%90%9C%EB%8B%A4%EB%A9%B4">&lt;p&gt;debug build(안드로이드 스튜디오에서 run으로 실행하던)에서는 잘만 되던 통신이 release build에선 갑자기 안된다면?&lt;/p&gt;

&lt;p&gt;권한만 한줄 추가해주면 된다! 간단!&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;project 경로/android/app/src/main/AndroidManifest.xml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;파일을 열어준다. &lt;strong&gt;main 폴더 안으로&lt;/strong&gt; 들어가야함에 유의❗️&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;위 코드를 아래의 위치에 끼워넣어준다.&lt;/p&gt;
&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;manifest&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:android=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;package=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;io.company.appName&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;android.permission.INTERNET&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt; 
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;application&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:label=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;appName&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;이제 다시 실행해보면??&lt;/p&gt;

&lt;p&gt;release build도, apk로 추출해서 실행해도 잘된다😄&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><author><name></name></author><category term="개발" /><category term="Flutter" /><summary type="html">debug build(안드로이드 스튜디오에서 run으로 실행하던)에서는 잘만 되던 통신이 release build에선 갑자기 안된다면?</summary></entry></feed>