openrpc_dart 0.1.2 openrpc_dart: ^0.1.2 copied to clipboard
An OpenRPC JSON Spec Parser, fromJson and toJson
example/openrpc_dart_example.dart
import 'package:openrpc_dart/openrpc_dart.dart';
import 'dart:io';
void main() async {
List<String> jsonFileNameList = [
"api-with-examples-openrpc.json",
"empty-openrpc.json",
"link-example-openrpc.json",
"metrics-openrpc.json",
"params-by-name-petstore-openrpc.json",
"petstore-expanded-openrpc.json",
"petstore-openrpc.json",
"simple-math-openrpc.json"
];
String currentWorkingDirectory = Directory.current.path;
jsonFileNameList.forEach((jsonFileName) async {
print("FILE_NAME: $jsonFileName");
String jsonPath = "$currentWorkingDirectory/example/json/$jsonFileName";
OpenRPCLoader openRPCLoader = OpenRPCLoader();
OpenRPC openRPC = await openRPCLoader.loadFromFile(jsonPath);
print("title: ${openRPC.info.title}");
});
}