alexeyinkin commented on code in PR #24457: URL: https://github.com/apache/beam/pull/24457#discussion_r1067719822
########## playground/frontend/playground_components/lib/src/controllers/public_notifier.dart: ########## @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import 'package:flutter/material.dart'; + +class PublicNotifier extends ChangeNotifier { Review Comment: We aim to eliminate the use of `Provider`s because they make it hard to refactor, and Flutter team even [refuses to think about this problem](https://github.com/flutter/flutter/issues/116768). As for 'get_it', you can think of it as just as a global map of objects with compile-time type safety of entries. It implements the 'service locator' pattern, this is why we populate it in `locator.dart`. This class on its own is just a notifier that can be triggered from outside and passes its change signal to whoever listens to it. It is only compensating for the standard `ChangeNotifier`'s inability to be triggered from outside and has nothing to do with `get_it`. It then has multiple use cases. One of them is to pass both an event emitter and its trigger into a function: https://github.com/akvelon/beam/blob/dc4e142f25e1c7efa23b26a04158e1f208ea3864/learning/tour-of-beam/frontend/lib/components/login/button.dart#L32 This is a null-safe improvement over the previous solution: https://github.com/apache/beam/blob/e21b5b79a25dec5555389a87c3d638219d09e2c9/learning/tour-of-beam/frontend/lib/components/login/login_button.dart#L39 The new solution is also reusable while before we had to copy the entire method code for each overlay. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
