Skip to content

Instantly share code, notes, and snippets.

@agiletelescope
agiletelescope / file.dart
Created September 15, 2019 16:22
Flutter Reorderable ListView
import 'package:flutter/material.dart';
class QuestionsPage extends StatefulWidget {
@override
_QuestionsPageState createState() => _QuestionsPageState();
}
class _QuestionsPageState extends State<QuestionsPage> {
// List of items
@agiletelescope
agiletelescope / gist:fe4fce7aafdceed00d00c3f1db9ecf54
Last active August 15, 2019 11:51
Singleton classes in dart from dartpad
class MySingleton {
int resource = 5;
// Singleton pattern
static final MySingleton _singleton = new MySingleton._internal();
factory MySingleton({int newResource}) {
// Called everytime an object is created.
// If an instance of the class already exists, then returns the existing reference,
// else creates a new reference and returns it.