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
sealed class User { | |
// Private constructor | |
User._(); | |
// Factory constructor | |
factory User.fromJson(Map<String, dynamic) { | |
return switch(json['type']) { | |
'external' => ExternalUser(name: json['name'] as String), | |
'privileged' => PrivilegedUser(name: json['name'] as String, json['roles'] as List<String>), |
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
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> { |
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
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 |
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'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |
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
{ | |
"featureType": "all", | |
"elementType": "labels.text.stroke", | |
"stylers": [ | |
{ | |
"color": "{textTheme.bodyText2}" | |
}, | |
{ | |
"visibility": "off" | |
} |
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/services.dart' show rootBundle; | |
class _MapOnSteroids extends State<MapOnSteroids> { | |
Completer<GoogleMapController> _controllerCompleter = Completer(); | |
String _mapStyle; | |
bool _mapStyleLoaded = false; | |
@override |
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 Set<Marker> _markers = [ | |
Marker( | |
markerId: MarkerId("montpellier-france"), | |
position: LatLng(43.617529, 3.9129273), | |
); | |
].toSet(); | |
Widget build(BuildContext context) { | |
return GoogleMap( | |
mapType: MapType.normal, |
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
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]); | |
} |
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_web_ui/ui.dart' as ui; | |
import 'package:flutter_web/material.dart'; | |
main() async { | |
await ui.webOnlyInitializePlatform(); | |
runApp( | |
MaterialApp( | |
home: Scaffold(body: ComplexLayoutApp()), | |
), | |
); |
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 '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()); |
NewerOlder