Andrew's Garage

Shrunk Expand

Primary Navigation

싱글톤(Singleton) 클래스

class Singleton {
  static final Singleton _instance = Singleton._internal();

  factory Singleton() {
    return _instance;
  }

  Singleton._internal() { //클래스가 최초 생성될때 1회 발생
    //초기화 코드    
  }
}

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related


Posted on 2021-05-18 1:21 AM by andrew Comment
📂This entry was posted in flutter

Related Posts

  • 2021-05-18 andrew

    Back Button 막기(Disable Back Button)

    WillPopScope 위젯을 사용한다. scaffold를 WillPopScope로 감싸서 처리 한다. return Scaffold( appBar: AppBar( title: Te...
  • 2021-05-18 andrew

    FutureBuilder

    Future가 있는 위젯을 만들기위해선 Stateful 위젯으로 해둔 다음에, 로딩이 완료되면 그 값에 따라 setstate을 다시 해야했다.  코드가 굉장히 지저분해지고...
« machine_learning_flutter_app QR 코드 스캔(QR Code Scan) 초간단 예제(Simple example) »

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

( optional )


©2025 boots Entries RSS and Comments RSS Child theme Boots of Raindrops Theme