Skip to content

Instantly share code, notes, and snippets.

@maherjaafar
maherjaafar / main.dart
Last active August 24, 2022 13:38 — forked from slightfoot/main.dart
Firestore Chat List Example - by Simon Lightfoot - 07/05/2020
// MIT License
//
// Copyright (c) 2020 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@maherjaafar
maherjaafar / Extract Widget
Last active October 12, 2021 10:34
Extract Widget
import 'package:flutter/material.dart';
import 'package:share/share.dart';
// Instead, do this ✅
class SharePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: ShareButton(link:'https://www.hackberry.se'),
);
@maherjaafar
maherjaafar / Extract method
Last active October 12, 2021 10:32
Extract method
import 'package:flutter/material.dart';
import 'package:share/share.dart';
// Don't do this ❌
class SharePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: _shareButton('https://www.hackberry.se'),
@maherjaafar
maherjaafar / const text
Created October 12, 2021 09:31
Const text
const Text('Thanks! 😃'),
@maherjaafar
maherjaafar / Non const text
Created October 12, 2021 09:26
Non const text
Text('No ❌, I want to be const'),
@maherjaafar
maherjaafar / Future.microTask example
Last active October 12, 2021 09:24
Future.microTask()
Future.microtask(() async {
String? data;
data = await getString();
return data;
}).then((value) => print(value));