Skip to content

Instantly share code, notes, and snippets.

@rootext
rootext / app.dart
Created May 21, 2019 07:22
Dart + SDL2 crash example
import 'dart:ffi';
import 'dart:convert';
void main() {
var sdl = DynamicLibrary.open('SDL2.dll');
loadSDL(sdl);
sdlInit(SDL_INIT_VIDEO);
var title = CString.fromUtf8('Dart FFI + SDL');
@rootext
rootext / decode.dart
Last active January 21, 2019 16:43 — forked from mraleph/decode.dart
library mirrors.src.decode;
import 'dart:mirrors' as mirrors;
import 'dart:convert';
/// Create an object of the given type [t] from the given JSON string.
decode(String json, Type t) {
// Get deserialization descriptor for the given type.
// This descriptor describes how to handle the type and all its fields.
final TypeDesc desc = getDesc(t);