cclled 0.0.1 copy "cclled: ^0.0.1" to clipboard
cclled: ^0.0.1 copied to clipboard

PlatformAndroid

ccl led plugin

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:cclled/cclled.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('CCL LED Plugin Test'),
        ),
        body: const CclledTestWidget(),
      ),
    );
  }
}

class CclledTestWidget extends StatefulWidget {
  const CclledTestWidget({super.key});

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

class CclledTestWidgetState extends State<CclledTestWidget> {
  final Cclled _cclled = Cclled();
  String _result = "No result yet";

  @override
  void initState() {
    super.initState();
    _testPlugin();
  }

  Future<void> _testPlugin() async {
    try {
      _result = (await _cclled.getPlatformVersion()) ?? "";
      // setState(() {
      //   _result = "Platform version: $_result";
      // });
      // await _cclled.init('ZY_3288_GPIO');
      // await _cclled.setLightStatus(1, 0, '/dev/ttyUSB0', 9600);
      // List<String> devices = await _cclled.getAllDevicesPath();
      // setState(() {
      //   _result = "Available devices: ${devices.join(', ')}";
      // });
    } catch (e) {
      setState(() {
        _result = "Error: $e";
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Text(_result),
    );
  }
}
0
likes
150
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

ccl led plugin

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on cclled