blob: b43ea98c0f25c2ff2b6b5612de493c68f7e5cc7b [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:fidl_fuchsia_modular/fidl.dart';
import 'package:fidl/fidl.dart';
import 'package:flutter/widgets.dart';
/// Watches for changes to the user logged in status.
class UserWatcherImpl extends UserWatcher {
final UserWatcherBinding _binding = new UserWatcherBinding();
/// Called when the user logs out.
final VoidCallback onUserLogout;
/// Constructor.
UserWatcherImpl({this.onUserLogout});
/// Gets the handle of this [UserWatcher].
InterfaceHandle<UserWatcher> getHandle() => _binding.wrap(this);
@override
void onLogout() {
onUserLogout?.call();
}
/// Closes any handles owned by this [UserWatcher].
void close() => _binding.close();
}