Skip to content

Instantly share code, notes, and snippets.

View eric-taix's full-sized avatar
🚀

Eric Taix eric-taix

🚀
View GitHub Profile
void main() {
final l = List.generate(5, (index) => index * 2);
print(l);
print(l.insertBetween(100));
print(l.insertBetweenAndAround(100));
print(l.fillUpTo(count: 10, value: 100));
print(l.fillUpTo(count: 3, value: 100));
}
extension IterableExtension<T> on Iterable<T> {
iVBORw0KGgoAAAANSUhEUgAAA8AAAAUACAIAAAAHjKxCAAAAAXNSR0IArs4c6QAAAANzQklUCAgI2+FP4AAAIABJREFUeJzMve2W7biqKAZItmdV73OSPEv+5gny/q+R3H137+5VNW1BfiBhhGTXrOred0RjjVqetj4QAoQQQvh//1//JzOLJgARAQAAQERoyZ70WwEhqXkQUYv6/JoYAQBI4MsU6uf225clRG1FRFJCZs5IACCE2rQCo3k9FF837zqLiERERPpGRKwG31no8fNaE8lw2yd2eWqdU3y2RCKCKABACZiZC/z+++8fn+Wf//wnpnUvBxExiPUiZ1rzsm7LtmQiIgAiQiEdd2zJmraW2jN/2d+xuNU8Zpu2GPJf4OpMfX62l1c98hV2tI0YaP6KnkNmIqIERKR0mJQakQCAgf6f//H//vHHH0WEGYgoExBRSmlZliVRSsmjQkRsLKAAIuaFtm1Zl0yk3MBbIkRMtbvCzFo259ouIgrq8GpnBQCQBAASCCISCiIK5BEJnqQVDFfPiWpmZmYAVvilJQK0IgwR276bCYmZiYiZAUB7ISJKySklESEiEdmf5fl8btvbuq7MBwAAMiKCUKg5DHGgOsWA4JCzYCkFRIhIeR7o7FGHCkCDs6NABBEhrADb+19/fhJRzllhDiAZKpSEAKCUovX7DF7UHMdBROu66hBonlKKr9kyA0gpRYdjXdfjOKp051pk27a3t9+WZalUhx0+lbzAsaq9VXlSBP2nMVvob+A+g1b7bmQTahh5VpHs/1aKWnIjy1oJQSelrWZlMU/Y2CWyJ61Qx+XgwwYrpazFz7aolrJeiLTJ1BESIvrWfA2MAgAIVryTnzAIRmzzYBh9D5j1QofY5wytj3gIQ6CVjMNts6QXF9DoUES4TWvMzHxw+605U0oAoEQYOAsRAc+fPIMwyGfPlyI85ncpdjAlCm8M7A6k/sEXMUSN+aGJOHtvk7LScNAl/KCHhrR+x+YnBcIsjSygb1TGjvjU9z55
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@eric-taix
eric-taix / google-map-style.json
Last active January 25, 2021 21:08
Google map style
{
"featureType": "all",
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "{textTheme.bodyText2}"
},
{
"visibility": "off"
}
@eric-taix
eric-taix / google-map-with-styles.dart
Last active January 26, 2021 00:28
Google map with styles
import 'package:flutter/services.dart' show rootBundle;
class _MapOnSteroids extends State<MapOnSteroids> {
Completer<GoogleMapController> _controllerCompleter = Completer();
String _mapStyle;
bool _mapStyleLoaded = false;
@override
@eric-taix
eric-taix / google-map.dart
Last active January 25, 2021 13:31
Google Maps with markers
final Set<Marker> _markers = [
Marker(
markerId: MarkerId("montpellier-france"),
position: LatLng(43.617529, 3.9129273),
);
].toSet();
Widget build(BuildContext context) {
return GoogleMap(
mapType: MapType.normal,
@eric-taix
eric-taix / main.dart
Created February 18, 2020 11:41
Dart dynamic attributes using Json
void main() {
var me = Person("Taix", 52, "Montpellier");
var myTown = City("Montpellier", 277639);
showAttribute(me, "name");
showAttribute(myTown, "population");
}
void showAttribute(Jsonifiable object, String attribute) {
print(object.toJson()[attribute]);
}
import 'package:flutter_web_ui/ui.dart' as ui;
import 'package:flutter_web/material.dart';
main() async {
await ui.webOnlyInitializePlatform();
runApp(
MaterialApp(
home: Scaffold(body: ComplexLayoutApp()),
),
);
@eric-taix
eric-taix / gist:d498b0fae3ed7af59d88
Created February 21, 2015 17:22
gc-skynet-the-chasm
import 'dart:io';
import 'dart:math';
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
void main() {
int roadLength = int.parse(stdin.readLineSync());
int gapLength = int.parse(stdin.readLineSync());
@eric-taix
eric-taix / gist:e97600883a71140c6985
Created February 21, 2015 17:03
gc-power-of-thor
import 'dart:io';
import 'dart:math';
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
Point lightOfPowerPoint;
Point thorPoint;