flutterx_live_data 1.0.1-dev copy "flutterx_live_data: ^1.0.1-dev" to clipboard
flutterx_live_data: ^1.0.1-dev copied to clipboard

outdated

LiveData is a data holder class that can be observed. This is a Flutter implementation of LiveData in Android Jetpack library

example/lib/main.dart

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutterx LiveData Demo',
      theme: ThemeData(primarySwatch: Colors.teal),
      home: const LiveDataExample());
}

class LiveDataExample extends StatefulWidget {
  const LiveDataExample({Key? key}) : super(key: key);

  @override
  State<LiveDataExample> createState() => _LiveDataExampleState();
}

class _LiveDataExampleState extends State<LiveDataExample> {
  final MutableLiveData<int> myCounter = MutableLiveData(initialValue: 0);

  @override
  Widget build(BuildContext context) => Scaffold(
      appBar: AppBar(title: const Text('LiveData example')),
      body: Center(
          child: LiveDataBuilder<int>(data: myCounter, builder: (context, value) => Text('pressed $value times'))),
      floatingActionButton: FloatingActionButton(onPressed: () => myCounter.value++, child: const Icon(Icons.add)));
}
13
likes
0
points
770
downloads

Publisher

unverified uploader

Weekly Downloads

LiveData is a data holder class that can be observed. This is a Flutter implementation of LiveData in Android Jetpack library

Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

flutter, flutterx_utils

More

Packages that depend on flutterx_live_data