Skip to content

Instantly share code, notes, and snippets.

View marcel-ploch's full-sized avatar

Marcel Ploch marcel-ploch

View GitHub Profile
@marcel-ploch
marcel-ploch / main.dart
Created November 23, 2022 22:03
RichTextExample
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@marcel-ploch
marcel-ploch / main.dart
Created November 23, 2022 22:24
Singletons in Dart sind doch so einfach
class MeinSingleton {
/// Unsere Singleton Instanz, die einmalig instanziiert wird
static final MeinSingleton _singleton = MeinSingleton._internal();
/// Member Variable, die zugreifbar gemacht werden soll
late List<dynamic> data = [];
/// Factory Constructor, der die Instanz der Klasse zurückgibt, egal wann sie aufgerufen wird
factory MeinSingleton() {
return _singleton;
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,