skip to Main Content

Flutter – why do they instantiate the class and then throw that instance away?

I am trying to learn Dart language along with flutter. I have come across the following piece of code (taken from here: https://github.com/ppicas/flutter-android-background/blob/master/lib/counter_service.dart) : import 'package:flutter/foundation.dart'; import 'counter.dart'; class CounterService { factory CounterService.instance() => _instance; CounterService._internal(); <<====================== Why is this…

VIEW QUESTION
Back To Top
Search