built_viewmodel 1.1.1 copy "built_viewmodel: ^1.1.1" to clipboard
built_viewmodel: ^1.1.1 copied to clipboard

discontinued
outdated

built_viewmodel to generate ViewModel(s). This library is the runtime dependency.

example/lib/main.dart

// Copyright (c) 2018, Ralph Bergmann.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

library main;

import 'dart:async';

import 'package:built_viewmodel/built_viewmodel.dart';

part 'main.g.dart';

void main(List<String> arguments) {
  final model = new MyHomePageViewModel();
  model.counter.listen((int value) => print('got $value'));

  model.setCounter(0);
  model.setCounter(1);
  model.setCounter(2);
  model.setCounter(3);
}

abstract class MyHomePageViewModel implements ViewModel<MyHomePageViewModelController> {
  Stream<int> get counter;

  @OnListenHandler('counter')
  void onListen() => print('someone is listening');

  void setCounter(int value) => controller.counter.add(value);

  factory MyHomePageViewModel() = _$MyHomePageViewModel;

  MyHomePageViewModel._();
}
0
likes
0
points
36
downloads

Publisher

unverified uploader

Weekly Downloads

built_viewmodel to generate ViewModel(s). This library is the runtime dependency.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

build_config

More

Packages that depend on built_viewmodel