woosignal 3.14.3 copy "woosignal: ^3.14.3" to clipboard
woosignal: ^3.14.3 copied to clipboard

WooCommerce REST API for dart, connect a WooCommerce store and start developing with our interface for their API endpoints.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:woosignal/woosignal.dart';
import 'package:woosignal/models/response/product.dart';

void woosignalWoocommerceExample() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'WooSignal Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'WooSignal Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _productName = "";

  _incrementCounter() async {
    // CREATING AN INSTANCE FOR WOOSIGNAL
    await WooSignal.instance.init(appKey: "your app key");

    List<Product> products = await WooSignal.instance.getProducts();
    if (products.isNotEmpty) {
      _productName = products[0].name ?? "";
    }
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text('Tap the light bulb to get a product'),
            if (_productName != "")
              Text(
                'WooCommerce product :\n $_productName',
              ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.lightbulb_outline),
      ),
    );
  }
}
60
likes
0
points
954
downloads

Publisher

verified publisherwoosignal.com

Weekly Downloads

WooCommerce REST API for dart, connect a WooCommerce store and start developing with our interface for their API endpoints.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

device_meta, dio, encrypt, flutter

More

Packages that depend on woosignal