Flutter Engine
The Flutter Engine
PlatformViewRegistryImpl.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package io.flutter.plugin.platform;
6
7import java.util.HashMap;
8import java.util.Map;
9
11
13 viewFactories = new HashMap<>();
14 }
15
16 // Maps a platform view type id to its factory.
17 private final Map<String, PlatformViewFactory> viewFactories;
18
19 @Override
20 public boolean registerViewFactory(String viewTypeId, PlatformViewFactory factory) {
21 if (viewFactories.containsKey(viewTypeId)) return false;
22 viewFactories.put(viewTypeId, factory);
23 return true;
24 }
25
26 PlatformViewFactory getFactory(String viewTypeId) {
27 return viewFactories.get(viewTypeId);
28 }
29}
boolean registerViewFactory(String viewTypeId, PlatformViewFactory factory)