add sdk
This commit is contained in:
parent
7fb3f2582e
commit
3e66f24c74
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_service/model/CategoryResponse.dart';
|
import 'package:flutter_service/model/CategoryResponse.dart';
|
||||||
import 'package:flutter_service/provider/CategoryProvider.dart';
|
import 'package:flutter_service/provider/CategoryProvider.dart';
|
||||||
import 'package:flutter_service/sdk/ClientSDK.dart';
|
import 'package:flutter_service/sdk/ClientSDK.dart';
|
||||||
|
import 'package:flutter_service/sdk/ClientSDK.dart';
|
||||||
import 'package:flutter_service/wrapper/ProviderWrapper.dart';
|
import 'package:flutter_service/wrapper/ProviderWrapper.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ class MyHomePage extends StatefulWidget {
|
|||||||
_MyHomePageState createState() => _MyHomePageState();
|
_MyHomePageState createState() => _MyHomePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientSDK client = ClientSDK();
|
ClientSDK sdk = ClientSDK.instance;
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
|
|
||||||
@ -73,13 +74,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
categories = Provider.of<CategoryProvider>(context, listen: true)
|
categories = Provider.of<CategoryProvider>(context, listen: true)
|
||||||
.getCategories();
|
.getCategories();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void init(BuildContext context) async {
|
void init(BuildContext context) async {
|
||||||
List<CategoryResponse> result = await client.clientGetAllCategoryService();
|
List<CategoryResponse> result = await sdk.clientGetAllCategoryService();
|
||||||
Provider.of<CategoryProvider>(context, listen: false).setCategories(result);
|
Provider.of<CategoryProvider>(context, listen: false).setCategories(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -5,6 +5,14 @@ import 'package:flutter_service/service/CategoryService.dart';
|
|||||||
|
|
||||||
class ClientSDK {
|
class ClientSDK {
|
||||||
|
|
||||||
|
ClientSDK._privateConstructor();
|
||||||
|
|
||||||
|
static final ClientSDK _instance = ClientSDK._privateConstructor();
|
||||||
|
|
||||||
|
static ClientSDK get instance => _instance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Future<List<CategoryResponse>> clientGetAllCategoryService() async {
|
Future<List<CategoryResponse>> clientGetAllCategoryService() async {
|
||||||
return await getAllCategoryService();
|
return await getAllCategoryService();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user