-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Добавили поддержку нового эмбедера для location_aurora и исправ…
…или документацию * location, changes for new flutter version --------- Signed-off-by: deadbeef <[email protected]> Co-authored-by: mozerrr <[email protected]>
- Loading branch information
Showing
10 changed files
with
189 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 1.1.0 | ||
|
||
* Добавлена поддержка эмбедера 3.16.2.-2 | ||
|
||
## 1.0.0 | ||
|
||
* Open Source release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <[email protected]> | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
#ifndef FLUTTER_PLUGIN_ENCODABLE_HELPER_H | ||
#define FLUTTER_PLUGIN_ENCODABLE_HELPER_H | ||
|
||
#include <flutter/encodable_value.h> | ||
|
||
typedef flutter::EncodableValue EncodableValue; | ||
typedef flutter::EncodableValue EncodableValue; | ||
typedef flutter::EncodableMap EncodableMap; | ||
typedef flutter::EncodableList EncodableList; | ||
|
||
namespace Helper { | ||
|
||
// ========== encodable_value ========== | ||
|
||
template <typename T> | ||
inline bool TypeIs(const EncodableValue & val) { | ||
return std::holds_alternative<T>(val); | ||
} | ||
|
||
template <typename T> | ||
inline const T GetValue(const EncodableValue & val) { | ||
return std::get<T>(val); | ||
} | ||
|
||
inline EncodableMap GetMap(const EncodableMap& map, const std::string& key) { | ||
auto it = map.find(EncodableValue(key)); | ||
if (it != map.end() && TypeIs<EncodableMap>(it->second)) | ||
return GetValue<EncodableMap>(it->second); | ||
return EncodableMap(); | ||
} | ||
|
||
inline EncodableList GetList(const EncodableMap& map, const std::string& key) { | ||
auto it = map.find(EncodableValue(key)); | ||
if (it != map.end() && TypeIs<EncodableList>(it->second)) | ||
return GetValue<EncodableList>(it->second); | ||
return EncodableList(); | ||
} | ||
|
||
inline int GetInt(const EncodableMap& map, const std::string& key) { | ||
auto it = map.find(EncodableValue(key)); | ||
if (it != map.end() && TypeIs<int>(it->second)) | ||
return GetValue<int>(it->second); | ||
return -1; | ||
} | ||
|
||
inline bool GetBool(const EncodableMap& map, const std::string& key) { | ||
auto it = map.find(EncodableValue(key)); | ||
if (it != map.end() && TypeIs<bool>(it->second)) | ||
return GetValue<bool>(it->second); | ||
return false; | ||
} | ||
|
||
inline std::string GetString(const EncodableMap& map, const std::string& key) { | ||
auto it = map.find(EncodableValue(key)); | ||
if (it != map.end() && TypeIs<std::string>(it->second)) | ||
return GetValue<std::string>(it->second); | ||
return std::string(); | ||
} | ||
|
||
inline std::vector<int> GetVectorInt(const EncodableMap& map, const std::string& key) { | ||
auto it = map.find(EncodableValue(key)); | ||
std::vector<int> result{}; | ||
if (it != map.end() && TypeIs<std::vector<EncodableValue>>(it->second)) | ||
for (auto item : GetValue<std::vector<EncodableValue>>(it->second)) { | ||
result.push_back(GetValue<int>(item)); | ||
} | ||
return result; | ||
} | ||
|
||
inline std::vector<double> GetVectorDouble(const EncodableMap& map, const std::string& key) { | ||
auto it = map.find(EncodableValue(key)); | ||
std::vector<double> result{}; | ||
if (it != map.end() && TypeIs<std::vector<EncodableValue>>(it->second)) | ||
for (auto item : GetValue<std::vector<EncodableValue>>(it->second)) { | ||
result.push_back(GetValue<double>(item)); | ||
} | ||
return result; | ||
} | ||
|
||
} // namespace Helper | ||
|
||
#endif /* FLUTTER_PLUGIN_ENCODABLE_HELPER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.