Skip to content

Instantly share code, notes, and snippets.

@fvisticot
fvisticot / DDAnnotationView.m
Created August 17, 2011 11:58
DDAnnotationView.m
#import "DDAnnotationView.h"
#import "DDAnnotation.h"
#pragma mark -
#pragma mark DDAnnotationView implementation
@implementation DDAnnotationView
@synthesize mapView = _mapView;
@fvisticot
fvisticot / settings_page.dart
Created December 1, 2018 09:13
Debug Google Maps View in ListView
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class SettingsPage extends StatefulWidget {
@override
createState() => SettingsPageState();
}
class SettingsPageState extends State<SettingsPage> {
GoogleMapController _mapController;
@fvisticot
fvisticot / main.dart
Last active October 3, 2019 21:49
Dart contructors
void main() {
Book book = Book(title: 'bookTitle', description: 'bookDescription');
Book book2 = Book.fromMap({'title': 'Book2', 'description': 'desc2'});
print(book);
print(book2);
SuperBook superBook = SuperBook(title: "superBookTitle", description: "superBookDesc", size: 10);
print(superBook);
Author author1 = Author('fred', 'visticot');
@fvisticot
fvisticot / main.dart
Created March 19, 2019 17:35
Dart async
import 'dart:async';
import 'dart:math';
//https://www.dartlang.org/articles/language/beyond-async
void main() async {
//final stocksSync = StocksService().stocksSync();
//print(stocksSync);
//final stocksAsync = await StocksService().stocksAsync();
//print(stocksAsync);
@fvisticot
fvisticot / main.dart
Created October 3, 2019 21:59
Abstract class
void main() {
Car car1 = Car("Car1");
car1.go();
car1.sayHello();
}
abstract class Vehicule {
final String name;
Vehicule(this.name);
@fvisticot
fvisticot / main.dart
Last active October 3, 2019 22:20
Exceptions
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}");
}
@fvisticot
fvisticot / main.dart
Last active October 3, 2019 22:27
lambda
void main() {
const books = [
const Book('book1', "book1 desc"),
const Book('book2', "book2 desc")
];
print("Books: $books");
books.forEach((book) => print("${book.title}"));
@fvisticot
fvisticot / main.dart
Last active October 3, 2019 22:31
Singleton
void main() {
print(new Singleton() == new Singleton());
}
class Singleton {
static final Singleton _instance = Singleton._internal();
Singleton._internal();
factory Singleton() => _instance;
@fvisticot
fvisticot / main.dart
Last active October 3, 2019 22:38
Divers...
void main() {
var book1 = Book("Titre", null);
var book2 = null;
print("${book1.description}");
print("${book2?.description}");
var test = book1.description ?? "default";
print(test);
@fvisticot
fvisticot / main.dart
Last active October 4, 2019 09:18
Exemple
void main() {
print("Hello world");
}