How to make a JSON object and pass this JSON object into an external JavaScript function?


I’m developing a game in Dart, and I want to migrate the drawing to PIXI.js. Basically one approach that occurred to me is to convert the game state into a JSON object, and pass this JSON object to an external JS method, which would then create the PIXI containers.

How do I make a JSON object and how do I pass it to an external JavaScript function?


import 'dart:convert';


var json = JSON.encode(data);
var data = JSON.decode(json);

You probably want to use for dart-js-interop.

Answered By – Günter Zöchbauer

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *