unmarshal 1.0.0 unmarshal: ^1.0.0 copied to clipboard
A Future-based wrapper around the Unmarshal APIs, providing comprehensive data on wallets, tokens, prices and protocols across 16+ blockchains for your decentralized applications.
import 'dart:convert';
import 'package:unmarshal/unmarshal.dart';
void main() async {
/// Load API keys using your preferred method
String authToken = 'YOUR_API_KEY';
/// Initialize the main object
Unmarshal api = Unmarshal(authToken: authToken);
try {
/// Call the API
Response response = await api.nfts.getNftsByAddress(
address: 'vitalik.eth',
chain: 'ethereum',
offset: 0,
pageSize: 25,
);
if (response.statusCode == 200) {
/// Do stuff with the response
print(response.statusCode);
print(json.decode(response.body));
} else {
/// Handle the server error
print('Server Error: ${response.statusCode}:');
print(response.body);
}
} catch (e) {
/// Throws an exception if an error occurs
print(e);
}
/// Close the connection
api.close();
}