Skip to content

Instantly share code, notes, and snippets.

@hectorAguero
Last active November 10, 2025 20:01
Show Gist options
  • Select an option

  • Save hectorAguero/4e54755964028fa74543216fbf1747a0 to your computer and use it in GitHub Desktop.

Select an option

Save hectorAguero/4e54755964028fa74543216fbf1747a0 to your computer and use it in GitHub Desktop.
Dart Flutter Pipe Propossal Sample
import 'package:flutter/material.dart';
enum Modes { light, dark }
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center()
|> Column(
space: 16,
mainAxisSize: .min,
mainAxisAlignment: .center,
crossAxisAlignment: .center) //how fmt should handle this ? -> )
|> const [
Text('Hello, World!'),
SizedBox(height: 16, width: 16),
Text('Flutter ❤️ Pipe'),
Padding(padding: .all(8))
|> Builder(builder: (_) => pipe) // pipe as reserved keyword?
|> SafeArea()
|> switch (mode) {
.light => Material()
|> Center()
|> Text('Light Mode', style: TextStyle(color: .black)),
.dark => Material()
|> Center()
|> Text('Dark Mode', style: TextStyle(
color: .white,
fontWeight: .bold,
fontSize: 20)
),
}
|> LayoutBuilder(builder: (context, constraints) => Container(
color: .blue,
padding: MediaQuery.paddingOf(context).bottom,
height: 100,
width: constraints.maxWidth)
|> Text('Context available here',
style: TextStyle(
color: .white,
fontWeight: .bold,
fontSize: 20)
),
),
),
],
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment