get method

Future<ComponentNode?> get(
  1. BuildContext context
)

Implementation

Future<ComponentNode?> get(BuildContext context) async {
  if (currentNode != null) {
    return currentNode!;
  }
  try {
    final data = await DefaultAssetBundle.of(context).load(
      path,
    );
    var content =
        String.fromCharCodes(await process(data.buffer.asUint8List()));
    final jsonResult = jsonDecode(content);
    return ComponentNode().fromJson(jsonResult);
  } catch (e) {
    print(e);
  }
  return null;
}