mayya_core 0.0.9
mayya_core: ^0.0.9 copied to clipboard
A Flutter plugin that provides core functionality for secure data handling, encryption, and device information management.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:mayya_core/mayya_core.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Mayya Core Example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final _core = MayyaCore(
appId: "ybIo7k1Xfh0ZFRTfrOy9Myuepfga6dCe1IPz4vszLPM=",
);
final TextEditingController _controller = TextEditingController();
String _result = '';
bool _isLoading = false;
Future<void> _getMediaPlayback() async {
setState(() {
_isLoading = true;
_result = '';
});
try {
final playback = await _core.getMediaPlayBack(
request: MediaRequest(streamCode: _controller.text.trim()),
);
setState(() {
_result = playback.toString();
});
} catch (e) {
setState(() {
_result = 'Error: $e';
});
} finally {
setState(() {
_isLoading = false;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Mayya Core Example'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
TextField(
controller: _controller,
decoration: const InputDecoration(
labelText: 'Stream Code',
border: OutlineInputBorder(),
),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _isLoading ? null : _getMediaPlayback,
child: const Text('Get Media Playback'),
),
const SizedBox(height: 24),
if (_isLoading) const Center(child: CircularProgressIndicator()),
if (_result.isNotEmpty)
Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(_result),
),
),
],
),
),
);
}
}