onAddToFavorites static method

Map onAddToFavorites(
  1. JSObject detail
)

Implementation

static Map onAddToFavorites(JSObject detail) {
  final currentRoute = MPNavigatorObserver.currentRoute;
  if (currentRoute != null &&
      _routeShareInfos[currentRoute.hashCode] != null) {
    final appShareInfo = _routeShareInfos[currentRoute.hashCode]!;
    return {
      "title": appShareInfo.title,
      "imageUrl": appShareInfo.imageUrl,
      "query": "${(() {
        final map = appShareInfo.query;
        String query = "";
        map.forEach((key, value) {
          query += "$key=${Uri.encodeFull(value)}&";
        });
        return query;
      })()}",
    };
  } else {
    return {};
  }
}