livedatax 1.0.0 copy "livedatax: ^1.0.0" to clipboard
livedatax: ^1.0.0 copied to clipboard

LiveDataX is a Dart package that brings the original LiveData, MutableLiveData and ViewModel classes from native Android code to Dart. It helps implement the MVVM pattern in Dart applications, followi [...]

example/livedatax_example.dart

import 'viewModel/example_view_model.dart';

void main() async {
  //create view model
  ExampleViewModel viewModel = ExampleViewModel(null);

  //observe data
  observer(value) {
    print('value: $value');
  }
  viewModel.liveData.observe(observer);

  //fetch data
  viewModel.getIntData();

  //simulation of network call with delay of 2 seconds
  await Future.delayed(Duration(seconds: 2));

  //remove observers
  viewModel.liveData.removeObserver(observer);
  //or, simply dispose
  viewModel.dispose();
}
1
likes
130
points
16
downloads

Publisher

verified publisher3p-cups.com

Weekly Downloads

LiveDataX is a Dart package that brings the original LiveData, MutableLiveData and ViewModel classes from native Android code to Dart. It helps implement the MVVM pattern in Dart applications, following Google's clean architecture principles.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on livedatax