Skip to content

Instantly share code, notes, and snippets.

@rootext
rootext / app.dart
Created May 21, 2019
Dart + SDL2 crash example
View app.dart
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');
View 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);
You can’t perform that action at this time.