Skip to content

Instantly share code, notes, and snippets.

View ltOgt's full-sized avatar
👁️‍🗨️

:o: ltOgt

👁️‍🗨️
View GitHub Profile
extension ForEachIndexedExtension<E> on List<E> {
/// Returns a new eagerly computed [List] with elements of type [T] that are created by
/// calling `f` on each element of this `List` with elements of type [E] in order of increasing index.
///
/// `f` exposes the index and the element at that index.
///
/// ___________
/// For example:
///
/// ```
@ltOgt
ltOgt / conditional_parent_widget.dart
Created June 29, 2020 14:50
Flutter Widget to conditionally wrap a subtree with a parent without breaking the code tree
import 'package:flutter/widgets.dart';
/// Conditionally wrap a subtree with a parent widget without breaking the code tree.
///
/// [condition]: the condition depending on which the subtree [child] is wrapped with the parent.
/// [child]: The subtree that should always be build.
/// [conditionalBuilder]: builds the parent with the subtree [child].
///
/// ___________
/// Usage: