cclled 0.0.1 cclled: ^0.0.1 copied to clipboard
ccl led plugin
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),
);
}
}