This file contains hidden or 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
| const blurhash = require('blurhash'); | |
| const { createCanvas, loadImage, Image } = require('canvas') | |
| const getImageData = (image) => { | |
| const canvas = createCanvas(image.width, image.height) | |
| const context = canvas.getContext('2d') | |
| context.drawImage(image, 0, 0) | |
| return context.getImageData(0, 0, image.width, image.height) | |
| } |
This file contains hidden or 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'; | |
| import 'package:flutter/rendering.dart'; | |
| import 'package:sliding_sheet/sliding_sheet.dart'; | |
| import 'package:webview_flutter/webview_flutter.dart'; | |
| class SlidingSheetWebView extends StatefulWidget { | |
| @override | |
| _SlidingSheetWebViewState createState() => _SlidingSheetWebViewState(); | |
| } |
This file contains hidden or 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:async'; | |
| void main() async { | |
| Future<int> computeCost(int val) async { | |
| await Future.delayed(Duration(seconds: 1)); | |
| return val * 2; | |
| } | |
| Stream<int> generateValues1() { | |
| return Stream.periodic(Duration(seconds: 1), (val) { |
This file contains hidden or 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:async'; | |
| void main() async{ | |
| Future<int>testTimer(int i) { | |
| final completer=Completer<int>(); | |
| Timer(Duration(seconds: 5), () { | |
| print("coucou from :$i"); | |
| if (i != 3) | |
| completer.complete(i); |
This file contains hidden or 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() { | |
| print("Hello world"); | |
| } |
This file contains hidden or 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 book1 = Book("Titre", null); | |
| var book2 = null; | |
| print("${book1.description}"); | |
| print("${book2?.description}"); | |
| var test = book1.description ?? "default"; | |
| print(test); | |
This file contains hidden or 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() { | |
| print(new Singleton() == new Singleton()); | |
| } | |
| class Singleton { | |
| static final Singleton _instance = Singleton._internal(); | |
| Singleton._internal(); | |
| factory Singleton() => _instance; |
This file contains hidden or 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() { | |
| const books = [ | |
| const Book('book1', "book1 desc"), | |
| const Book('book2', "book2 desc") | |
| ]; | |
| print("Books: $books"); | |
| books.forEach((book) => print("${book.title}")); | |
This file contains hidden or 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() { | |
| int res = ComputeService().add(2, 4); | |
| print("Res: $res"); | |
| try { | |
| int res = ComputeService().add(null, 4); | |
| print("Res: $res"); | |
| } on ComputeServiceException catch (e){ | |
| print("Error: ${e.cause}"); | |
| } |
This file contains hidden or 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() { | |
| Car car1 = Car("Car1"); | |
| car1.go(); | |
| car1.sayHello(); | |
| } | |
| abstract class Vehicule { | |
| final String name; | |
| Vehicule(this.name); |
NewerOlder