Trouble with Firebase.Xamarin lib

MarkSaushkinMarkSaushkin USMember
edited November 2017 in General

Hi all! I'm trying to get some object from Firebase Database. I'm using Firebase.Xamarin lib.
This is my code

public MainPage()
{
    InitializeComponent();

    var a = Get().Result;
}

public async Task<FirebaseObject<Mod>> Get()
{
    var firebase = new FirebaseClient("MY_URL/");
    var items = await firebase
        .Child("Mod")
        .OrderByKey()
        .LimitToFirst(2)
        .OnceAsync<Mod>();

    return items.First();
}

public class Mod
{
    public Mod(){ }

    public string Name { get; set; }
    public string Value { get; set; }
}

But after
var items = await firebase .Child("Mod").OrderByKey().LimitToFirst(2).OnceAsync<Mod>();
the code stops and I can't take my data.

Can anyone tell me what am I doing wrong?

This is my data on Firebase server
{
"Mod" : {
"-KzZ6echOrqMbP2176Gj" :
{
"Name" : "Mark",
"Value" : "Saushkin"
}
}
}

Sign In or Register to comment.