0 purchases
zeed sdk
Zeed Flutter SDK Documentation #
Overview #
The Zeed SDK allows developers to interact with the Zeed API for fetching financial data, stories, and stock images. This SDK provides a simple and efficient way to integrate Zeed's services into your Flutter application.
Initializing the SDK #
Before using the Zeed SDK, you must initialize it with your API key. Optionally, you can also set the language and prefetch a list of stock tickers.
ZeedConfiguration.init(
apiKey: 'your_api_key_here',
clientId: 'your_client_id_here',
userId: 'your_user_id_here',
lang: 'en', // Optional
stockList: ['AAPL', 'GOOGL', 'AMZN'], // Optional
);
copied to clipboard
Changing the Language #
You can change the language for API responses at any time.
ZeedConfiguration.changeLang(lang: 'ar');
copied to clipboard
Fetching the Stock List #
Fetch prefetched story data for a given stock list.
ZeedConfiguration.fetchStockList(stockList: ['AAPL', 'MSFT']);
copied to clipboard
Fetching Stock Images #
Fetch the stock image for a given financial asset.
var stockImage = await ZeedConfiguration.fetchStockImage(finasset: 'AAPL');
return Image.network(stockImage.logo);
copied to clipboard
API Methods #
init #
Initialize the SDK with required API values.
apiKey (required): Your API key for authenticating with the Zeed API.
clientId (required): Your client ID for authenticating with the Zeed API.
userId (required): Your user ID for tracking your customer with the Zeed API.
lang (optional): The language for API responses. Default is 'en'.
stockList (optional): A list of stock tickers to prefetch.
static init({required String apiKey, required String clientId, String? lang, List<String>? stockList})
copied to clipboard
changeLang #
Change the language for API responses.
lang (optional): The new language for API responses.
static changeLang({String? lang})
copied to clipboard
fetchStockList #
Fetch prefetched story data for a given stock list.
stockList (optional): A list of stock tickers to fetch data for.
static fetchStockList({List<String>? stockList})
copied to clipboard
fetchStockImage #
Fetch the stock image for a given financial asset.
finasset (required): The financial asset ticker.
static fetchStockImage({required String finasset}) async
copied to clipboard
Navigating to ZeedApp #
To navigate to the ZeedApp, you can use the following method. Ensure you have initialized the Zeed SDK with ZeedConfiguration.init and have passed the API key.
void _goToZeed() async {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const ZeedApp(
stock: 'NVDA',
),
),
);
}
copied to clipboard
You can also include an optional onPress function, which would receive an InformationModel as a parameter, an optional loading widget to replace the default loading widget as a parameter, and also an optional error widget to replace the default error widget as a parameter if required.
Example with onPress, Custom Loading Widget and Custom Error Widget:
void _goToZeed() async {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ZeedApp(
stock: 'NVDA',
onPress: (InformationModel info) {
// Handle the InformationModel
},
loadingWidget: CustomLoadingWidget(), // Custom loading widget
errorWidget: CustomErrorWidget(), // Custom error widget
),
),
);
}
copied to clipboard
Initialization and Prefetching #
Always initialize the Zeed SDK before navigating to the ZeedApp and ensure you pass the API key and client ID. You can also prefetch stories if needed using fetchStockList.
Initialization Example #
void main() {
ZeedConfiguration.init(
apiKey: 'your_api_key_here',
clientId: 'your_client_id_here',
userId: 'your_user_id_here',
lang: 'en', // Optional
stockList: ['AAPL', 'GOOGL', 'AMZN'], // Optional
);
}
copied to clipboard
Prefetching Stories Example #
By prefetching the stories using fetchStockList, the fetched stories are loaded into the cache, making them quickly accessible when navigating to the story page for those stories.
@override
void initState() {
super.initState();
ZeedConfiguration.fetchStockList(stockList: ['AAPL', 'MSFT']);
}
copied to clipboard
License #
This SDK is available under the MIT license. See the LICENSE file for more details.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.