You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@OverRide
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State {
List products = [];
Future getProducts() async {
/// Initialize the API
WooCommerceAPI wc_api = new WooCommerceAPI(
"http://localhost/ropaarmario/wp-json/wc/v2/products",
"ck_87f26757f5b65a28f50b9fb5b460793abb6f1d93",
"cs_fa87963767fbe06b60fa23da38f31d514c51e2a3"
);
/// Get data using the endpoint
var p = await wc_api.getAsync("products");
return p;
I copied your code but my app is stuck on Loading text its not fetching products
here's my code
`import 'dart:async';
import 'package:flutter/material.dart';
import 'package:woocommerce_api/woocommerce_api.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'WooCommerce API Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@OverRide
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State {
List products = [];
Future getProducts() async {
}
@OverRide
void initState() {
super.initState();
}
@OverRide
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: FutureBuilder(
future: getProducts(),
builder: (_, s){
}
}
`
i checked on postman its working through oauth authentication method
The text was updated successfully, but these errors were encountered: