This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
// | |
// Copyright (c) 2023 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RydMike LINTER Preferences v2.1.0 | |
# | |
# Get this file here: https://gist.github.com/rydmike/fdb53ddd933c37d20e6f3188a936cd4c | |
# | |
# We include and activate all lint rules, later below we disable the not used or desired ones. | |
# You can find a list of all lint rules to put in your all_lint_rules.yaml file here: | |
# https://dart-lang.github.io/linter/lints/options/options.html | |
# | |
# For a full comparison of all lint rules settings in rule styles listed below, please see this | |
# sheet: https://docs.google.com/spreadsheets/d/1Nc1gFjmCOMubWZD7f2E4fLhWN7LYaOE__tsA7bf2NjA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension on WidgetTester { | |
Future<void> launchApp() async { | |
await app.main(); | |
await pumpAndSettle(); | |
} | |
Future<void> clearState() async { | |
await SharedPreferences.getInstance().then((it) => it.clear()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Todo { | |
String title; | |
bool isDone; | |
Todo({ | |
required this.title, | |
this.isDone = false, | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final firstEndpointProvider = Provider<String>((_) { | |
throw Exception('Provider "firstEndpointProvider" was not initialized.'); | |
}); | |
final secondEndpointProvider = Provider<String>((_) { | |
throw Exception('Provider "secondEndpointProvider" was not initialized.'); | |
}); | |
final sharedPrefsProvider = Provider<SharedPreferences>((_) { | |
throw Exception('Provider "sharedPrefsProvider" was not initialized.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widgets.dart'; | |
extension IterableExtension on Iterable<Widget> { | |
// This extension method generates a new Iterable of Widgets that inserts | |
// a given separator between each element in the original Iterable. | |
Iterable<Widget> separatedBy(Widget separator) sync* { | |
bool isFirst = true; | |
for (final widget in this) { | |
if (!isFirst) yield separator; | |
yield widget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class DisallowIndicator extends StatelessWidget { | |
const DisallowIndicator({super.key, required this.child}); | |
final Widget child; | |
@override | |
Widget build(BuildContext context) { | |
return NotificationListener<OverscrollIndicatorNotification>( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git pull --rebase | |
# resolve conflicts file/files | |
git add . | |
# or | |
git add here/is/my/file.dart | |
git rebase --continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class CustomDialogTransition extends PageRouteBuilder { | |
CustomDialogTransition({ | |
required super.pageBuilder, | |
super.fullscreenDialog = true, | |
bool opaque = true, | |
bool barrierDismissible = true, | |
Color? barrierColor, | |
Duration transitionDuration = const Duration(milliseconds: 600), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension DarkMode on BuildContext { | |
bool get isDarkMode { | |
final brightness = MediaQuery.of(this).platformBrightness; | |
return brightness == Brightness.dark; | |
} | |
} |
NewerOlder