Closed s1dc0des closed 10 months ago
latest version
Could you show me some more examples of candid definitions? As well as the returned json
.
In the correct case, the definition foo: opt bar;
should return content of []
or [bar]
.
type Association =
record {
code: text;
country: opt text;
key: opt text;
name: text;
parent: opt text;
};
factory Association.fromJson(Map json) {
return Association(
code: json['code'],
country: (json['country'] as List).map((e) {
return e;
}).firstOrNull,
key: (json['key'] as List).map((e) {
return e;
}).firstOrNull,
name: json['name'],
parent: (json['parent'] as List).map((e) {
return e;
}).firstOrNull,
);
}
it should be something like this. also as List
cast isnt required for optional string. key
in this case. it throws error
factory Association.fromJson(Map json) {
return Association(
code: json['code'],
country: (json['country'] as List?)?.map((e) {
return e;
}).firstOrNull,
key: json['key'],
name: json['name'],
parent: (json['parent'] as List?)?.map((e) {
return e;
}).firstOrNull,
);
}
Could you print out the json
parameter?
factory Association.fromJson(Map json) {
print(json);// print json
return Association(
code: json['code'],
country: (json['country'] as List).map((e) {
return e;
}).firstOrNull,
key: (json['key'] as List).map((e) {
return e;
}).firstOrNull,
name: json['name'],
parent: (json['parent'] as List).map((e) {
return e;
}).firstOrNull,
);
}
In the correct case, the definition
foo: opt bar;
should return content of[]
or[bar]
.
Under normal circumstances, List
should never return null.
In the correct case, the definition
foo: opt bar;
should return content of[]
or[bar]
.
I have provided an official code example to demonstrate the point quoted above.
did: https://github.com/dfinity/nns-dapp/blob/570d2f2a9e9cd7f9cf6ccfbe990672878a92b093/frontend/src/lib/canisters/nns-dapp/nns-dapp.did#L84
ts: https://github.com/dfinity/nns-dapp/blob/570d2f2a9e9cd7f9cf6ccfbe990672878a92b093/frontend/src/lib/canisters/nns-dapp/nns-dapp.types.ts#L143
Is this your own canister? I feel it did not return the correct content.
adding data to canister. and other objects/models are working fine. just models with optional types are throwing errors.
{key: c__board__icc__c2ab7ee61, code: ICC, name: International Cricket Council, country: null, parent: null}
Are you using agent_dart to call the canister contract?
You can find sample applications here: https://github.com/AstroxNetwork/candid_dart/tree/main/apps/demo_app/lib
can you paste the did file of the canister @s1dc0des , and what is the result of interface if you generate using js?
.did
type Venue =
record {
city: text;
country: Country;
geolocation: text;
key: text;
name: text;
};
type UpdateResult =
variant {
err: Error;
ok;
};
type TournamentShort =
record {
key: text;
name: text;
short_name: text;
};
type Tournament =
record {
association_key: text;
competition: Competition;
countries: vec Country;
formats: vec text;
gender: text;
is_date_confirmed: bool;
is_venue_confirmed: bool;
key: text;
last_scheduled_match_date: float64;
metric_group: text;
name: text;
point_system: text;
short_name: text;
sport: text;
start_date: nat64;
};
type Toss =
record {
called: text;
elected: text;
winner: text;
};
type Time__1 = int;
type Time = int;
type TeamShort =
record {
code: text;
country_code: text;
key: text;
name: text;
};
type QueryUser =
record {
balance: nat;
id: nat;
lastEntry: Time;
liveContestNos: nat;
name: text;
"principal": principal;
totalCompletedContest: nat;
totalEntries: nat;
totalMatchParticipated: nat;
totalPoolParticipated: nat;
upcomingContestNos: nat;
};
type QueryResult_8 =
variant {
err: Error;
ok: text;
};
type QueryResult_7 =
variant {
err: Error;
ok: QueryEntry;
};
type QueryResult_6 =
variant {
err: Error;
ok: CricMatch__1;
};
type QueryResult_5 =
variant {
err: Error;
ok: QueryPool;
};
type QueryResult_4 =
variant {
err: Error;
ok: Tournament;
};
type QueryResult_3 =
variant {
err: Error;
ok: vec CricMatch__1;
};
type QueryResult_2 =
variant {
err: Error;
ok: vec QueryEntry;
};
type QueryResult_1 =
variant {
err: Error;
ok: QueryUser;
};
type QueryResult =
variant {
err: Error;
ok: vec Tournament;
};
type QueryPool =
record {
availableSpots: nat;
closedAt: opt Time;
createdAt: Time;
entryAmount: nat;
entryPerUser: nat;
filledSpots: nat;
id: PoolId;
matchId: text;
spots: nat;
status: PoolStatus;
title: text;
};
type QueryEntry =
record {
entryAt: Time;
id: EntryId__1;
matchId: text;
point: nat;
poolId: PoolId;
"principal": principal;
team: EntryArg;
username: text;
};
type Position =
variant {
all;
bat;
bow;
wic;
};
type PoolStatus =
variant {
closed;
full;
open;
};
type PoolId__1 = text;
type PoolId = text;
type MatchStatus =
variant {
completed;
live;
otherReasons: text;
upcoming;
};
type MatchKey = text;
type Error =
variant {
AnonymousNotAllowed;
CantSelectSameTeam: text;
EntryNotFound;
InsufficientBalance: nat;
MatchNotFound;
MatchStatusIs: MatchStatus;
MaxEntriesInPool: PoolId;
NotAController;
NotEnoughPlayersInTeam: text;
NotYourEntry;
PlayerAlreadyExist;
PlayerNotFound;
PoolNotFound;
PoolStatusIs: PoolStatus;
TeamAlreadyExists;
TeamNotFound: text;
TournamentNotFound;
UserAlreadyRegistered: record {
principal;
text;
};
UserNotFound;
};
type EntryId__1 = text;
type EntryId = text;
type EntryArg =
record {
backups: opt vec CPlayer;
captian: CPlayer;
players: vec CPlayer;
viceCaptian: CPlayer;
};
type CricMatch__1 =
record {
association: Association;
completedAt: opt Time__1;
format: text;
gender: text;
key: text;
messages: vec text;
metric_group: text;
name: text;
short_name: text;
sport: text;
start_at: nat64;
start_at_local: opt nat64;
status: text;
sub_title: text;
teams: record {
a: TeamShort;
b: TeamShort;
};
toss: opt Toss;
tournament: TournamentShort;
tournamentKey: text;
venue: Venue;
winner: text;
};
type CricMatch =
record {
association: Association;
completedAt: opt Time__1;
format: text;
gender: text;
key: text;
messages: vec text;
metric_group: text;
name: text;
short_name: text;
sport: text;
start_at: nat64;
start_at_local: opt nat64;
status: text;
sub_title: text;
teams: record {
a: TeamShort;
b: TeamShort;
};
toss: opt Toss;
tournament: TournamentShort;
tournamentKey: text;
venue: Venue;
winner: text;
};
type Country =
record {
code: text;
is_region: bool;
name: text;
official_name: text;
short_code: text;
};
type Competition =
record {
code: text;
key: text;
name: text;
};
type CPlayer =
record {
credit: nat;
id: nat;
name: text;
points: nat;
position: Position;
team: text;
};
type Association =
record {
code: text;
country: opt text;
key: opt text;
name: text;
parent: opt text;
};
service : {
addMatches: (vec CricMatch__1) -> (QueryResult_8);
addTournament: (Tournament) -> (UpdateResult);
addTournaments: (vec Tournament) -> (UpdateResult);
clearMatches: () -> (QueryResult_8);
clearTournaments: () -> (QueryResult_8);
deleteMatch: (text) -> (QueryResult_8);
fetchController: () -> (vec principal);
fetchTournaments: () -> (vec Tournament);
getAllContest: () -> (QueryResult_2) query;
getEntry: (EntryId) -> (QueryResult_7) query;
getLiveContest: () -> (QueryResult_2) query;
getLiveMatch: () -> (vec CricMatch) query;
getMatch: (MatchKey) -> (QueryResult_6) query;
getMatches: () -> (QueryResult_3) query;
getPool: (PoolId__1) -> (QueryResult_5) query;
getTournament: (text) -> (QueryResult_4) query;
getTournamentMatches: (text) -> (QueryResult_3);
getUpcomingContest: () -> (QueryResult_2) query;
getUpcomingMatch: () -> (vec CricMatch) query;
queryUser: () -> (QueryResult_1) query;
register: (text) -> (UpdateResult);
removeTournament: () -> (QueryResult);
updateEntry: (EntryId, EntryArg) -> (UpdateResult);
}
export const idlFactory = ({ IDL }) => {
const Time__1 = IDL.Int;
const TeamShort = IDL.Record({
'key' : IDL.Text,
'code' : IDL.Text,
'name' : IDL.Text,
'country_code' : IDL.Text,
});
const Country = IDL.Record({
'code' : IDL.Text,
'name' : IDL.Text,
'official_name' : IDL.Text,
'is_region' : IDL.Bool,
'short_code' : IDL.Text,
});
const Venue = IDL.Record({
'key' : IDL.Text,
'geolocation' : IDL.Text,
'country' : Country,
'city' : IDL.Text,
'name' : IDL.Text,
});
const Toss = IDL.Record({
'winner' : IDL.Text,
'called' : IDL.Text,
'elected' : IDL.Text,
});
const TournamentShort = IDL.Record({
'key' : IDL.Text,
'name' : IDL.Text,
'short_name' : IDL.Text,
});
const Association = IDL.Record({
'key' : IDL.Opt(IDL.Text),
'country' : IDL.Opt(IDL.Text),
'code' : IDL.Text,
'name' : IDL.Text,
'parent' : IDL.Opt(IDL.Text),
});
const CricMatch__1 = IDL.Record({
'key' : IDL.Text,
'status' : IDL.Text,
'completedAt' : IDL.Opt(Time__1),
'metric_group' : IDL.Text,
'teams' : IDL.Record({ 'a' : TeamShort, 'b' : TeamShort }),
'venue' : Venue,
'messages' : IDL.Vec(IDL.Text),
'start_at' : IDL.Nat64,
'name' : IDL.Text,
'toss' : IDL.Opt(Toss),
'winner' : IDL.Text,
'tournament' : TournamentShort,
'sport' : IDL.Text,
'gender' : IDL.Text,
'tournamentKey' : IDL.Text,
'start_at_local' : IDL.Opt(IDL.Nat64),
'short_name' : IDL.Text,
'sub_title' : IDL.Text,
'association' : Association,
'format' : IDL.Text,
});
const PoolStatus = IDL.Variant({
'closed' : IDL.Null,
'full' : IDL.Null,
'open' : IDL.Null,
});
const PoolId = IDL.Text;
const MatchStatus = IDL.Variant({
'upcoming' : IDL.Null,
'live' : IDL.Null,
'completed' : IDL.Null,
'otherReasons' : IDL.Text,
});
const Error = IDL.Variant({
'PlayerAlreadyExist' : IDL.Null,
'UserAlreadyRegistered' : IDL.Tuple(IDL.Principal, IDL.Text),
'NotAController' : IDL.Null,
'PoolStatusIs' : PoolStatus,
'MaxEntriesInPool' : PoolId,
'EntryNotFound' : IDL.Null,
'PoolNotFound' : IDL.Null,
'NotEnoughPlayersInTeam' : IDL.Text,
'AnonymousNotAllowed' : IDL.Null,
'PlayerNotFound' : IDL.Null,
'InsufficientBalance' : IDL.Nat,
'TeamAlreadyExists' : IDL.Null,
'TeamNotFound' : IDL.Text,
'MatchStatusIs' : MatchStatus,
'TournamentNotFound' : IDL.Null,
'MatchNotFound' : IDL.Null,
'NotYourEntry' : IDL.Null,
'CantSelectSameTeam' : IDL.Text,
'UserNotFound' : IDL.Null,
});
const QueryResult_8 = IDL.Variant({ 'ok' : IDL.Text, 'err' : Error });
const Competition = IDL.Record({
'key' : IDL.Text,
'code' : IDL.Text,
'name' : IDL.Text,
});
const Tournament = IDL.Record({
'key' : IDL.Text,
'metric_group' : IDL.Text,
'name' : IDL.Text,
'association_key' : IDL.Text,
'point_system' : IDL.Text,
'countries' : IDL.Vec(Country),
'start_date' : IDL.Nat64,
'sport' : IDL.Text,
'last_scheduled_match_date' : IDL.Float64,
'competition' : Competition,
'gender' : IDL.Text,
'is_date_confirmed' : IDL.Bool,
'short_name' : IDL.Text,
'is_venue_confirmed' : IDL.Bool,
'formats' : IDL.Vec(IDL.Text),
});
const UpdateResult = IDL.Variant({ 'ok' : IDL.Null, 'err' : Error });
const EntryId__1 = IDL.Text;
const Position = IDL.Variant({
'all' : IDL.Null,
'bat' : IDL.Null,
'bow' : IDL.Null,
'wic' : IDL.Null,
});
const CPlayer = IDL.Record({
'id' : IDL.Nat,
'name' : IDL.Text,
'team' : IDL.Text,
'credit' : IDL.Nat,
'position' : Position,
'points' : IDL.Nat,
});
const EntryArg = IDL.Record({
'players' : IDL.Vec(CPlayer),
'captian' : CPlayer,
'viceCaptian' : CPlayer,
'backups' : IDL.Opt(IDL.Vec(CPlayer)),
});
const Time = IDL.Int;
const QueryEntry = IDL.Record({
'id' : EntryId__1,
'principal' : IDL.Principal,
'username' : IDL.Text,
'team' : EntryArg,
'entryAt' : Time,
'matchId' : IDL.Text,
'point' : IDL.Nat,
'poolId' : PoolId,
});
const QueryResult_2 = IDL.Variant({
'ok' : IDL.Vec(QueryEntry),
'err' : Error,
});
const EntryId = IDL.Text;
const QueryResult_7 = IDL.Variant({ 'ok' : QueryEntry, 'err' : Error });
const CricMatch = IDL.Record({
'key' : IDL.Text,
'status' : IDL.Text,
'completedAt' : IDL.Opt(Time__1),
'metric_group' : IDL.Text,
'teams' : IDL.Record({ 'a' : TeamShort, 'b' : TeamShort }),
'venue' : Venue,
'messages' : IDL.Vec(IDL.Text),
'start_at' : IDL.Nat64,
'name' : IDL.Text,
'toss' : IDL.Opt(Toss),
'winner' : IDL.Text,
'tournament' : TournamentShort,
'sport' : IDL.Text,
'gender' : IDL.Text,
'tournamentKey' : IDL.Text,
'start_at_local' : IDL.Opt(IDL.Nat64),
'short_name' : IDL.Text,
'sub_title' : IDL.Text,
'association' : Association,
'format' : IDL.Text,
});
const MatchKey = IDL.Text;
const QueryResult_6 = IDL.Variant({ 'ok' : CricMatch__1, 'err' : Error });
const QueryResult_3 = IDL.Variant({
'ok' : IDL.Vec(CricMatch__1),
'err' : Error,
});
const PoolId__1 = IDL.Text;
const QueryPool = IDL.Record({
'id' : PoolId,
'status' : PoolStatus,
'title' : IDL.Text,
'entryAmount' : IDL.Nat,
'createdAt' : Time,
'spots' : IDL.Nat,
'closedAt' : IDL.Opt(Time),
'matchId' : IDL.Text,
'availableSpots' : IDL.Nat,
'entryPerUser' : IDL.Nat,
'filledSpots' : IDL.Nat,
});
const QueryResult_5 = IDL.Variant({ 'ok' : QueryPool, 'err' : Error });
const QueryResult_4 = IDL.Variant({ 'ok' : Tournament, 'err' : Error });
const QueryUser = IDL.Record({
'id' : IDL.Nat,
'upcomingContestNos' : IDL.Nat,
'principal' : IDL.Principal,
'totalEntries' : IDL.Nat,
'balance' : IDL.Nat,
'name' : IDL.Text,
'totalMatchParticipated' : IDL.Nat,
'totalCompletedContest' : IDL.Nat,
'lastEntry' : Time,
'totalPoolParticipated' : IDL.Nat,
'liveContestNos' : IDL.Nat,
});
const QueryResult_1 = IDL.Variant({ 'ok' : QueryUser, 'err' : Error });
const QueryResult = IDL.Variant({
'ok' : IDL.Vec(Tournament),
'err' : Error,
});
return IDL.Service({
'addMatches' : IDL.Func([IDL.Vec(CricMatch__1)], [QueryResult_8], []),
'addTournament' : IDL.Func([Tournament], [UpdateResult], []),
'addTournaments' : IDL.Func([IDL.Vec(Tournament)], [UpdateResult], []),
'clearMatches' : IDL.Func([], [QueryResult_8], []),
'clearTournaments' : IDL.Func([], [QueryResult_8], []),
'deleteMatch' : IDL.Func([IDL.Text], [QueryResult_8], []),
'fetchController' : IDL.Func([], [IDL.Vec(IDL.Principal)], []),
'fetchTournaments' : IDL.Func([], [IDL.Vec(Tournament)], []),
'getAllContest' : IDL.Func([], [QueryResult_2], ['query']),
'getEntry' : IDL.Func([EntryId], [QueryResult_7], ['query']),
'getLiveContest' : IDL.Func([], [QueryResult_2], ['query']),
'getLiveMatch' : IDL.Func([], [IDL.Vec(CricMatch)], ['query']),
'getMatch' : IDL.Func([MatchKey], [QueryResult_6], ['query']),
'getMatches' : IDL.Func([], [QueryResult_3], ['query']),
'getPool' : IDL.Func([PoolId__1], [QueryResult_5], ['query']),
'getTournament' : IDL.Func([IDL.Text], [QueryResult_4], ['query']),
'getTournamentMatches' : IDL.Func([IDL.Text], [QueryResult_3], []),
'getUpcomingContest' : IDL.Func([], [QueryResult_2], ['query']),
'getUpcomingMatch' : IDL.Func([], [IDL.Vec(CricMatch)], ['query']),
'queryUser' : IDL.Func([], [QueryResult_1], ['query']),
'register' : IDL.Func([IDL.Text], [UpdateResult], []),
'removeTournament' : IDL.Func([], [QueryResult], []),
'updateEntry' : IDL.Func([EntryId, EntryArg], [UpdateResult], []),
});
};
export const init = ({ IDL }) => { return []; };
sample CricMatch object
{key: asiacup_2023_g1, name: Pakistan vs Nepal, short_name: PAK vs NEP, sub_title: 1st Match, status: completed, start_at: 1693387800.0, tournament: {key: asiacup_2023, name: Asia Cup 2023, short_name: Asia Cup 2023}, metric_group: MG100, sport: cricket, winner: a, teams: {a: {key: pak, code: PAK, name: Pakistan, country_code: PAK}, b: {key: nep, code: NEP, name: Nepal, country_code: NPL}}, venue: {key: mcmultan4wci5g, name: Multan International Cricket Stadium, city: Multan City, country: {short_code: PK, code: PAK, name: Pakistan, official_name: Islamic Republic of Pakistan, is_region: false}, geolocation: 30.1707582,71.5247636}, association: {key: c__board__icc__c2ab7ee61, code: ICC, name: International Cricket Council, country: null, parent: null}, messages: [], gender: male, format: oneday}```
.did
type Venue = record { city: text; country: Country; geolocation: text; key: text; name: text; }; type UpdateResult = variant { err: Error; ok; }; type TournamentShort = record { key: text; name: text; short_name: text; }; type Tournament = record { association_key: text; competition: Competition; countries: vec Country; formats: vec text; gender: text; is_date_confirmed: bool; is_venue_confirmed: bool; key: text; last_scheduled_match_date: float64; metric_group: text; name: text; point_system: text; short_name: text; sport: text; start_date: nat64; }; type Toss = record { called: text; elected: text; winner: text; }; type Time__1 = int; type Time = int; type TeamShort = record { code: text; country_code: text; key: text; name: text; }; type QueryUser = record { balance: nat; id: nat; lastEntry: Time; liveContestNos: nat; name: text; "principal": principal; totalCompletedContest: nat; totalEntries: nat; totalMatchParticipated: nat; totalPoolParticipated: nat; upcomingContestNos: nat; }; type QueryResult_8 = variant { err: Error; ok: text; }; type QueryResult_7 = variant { err: Error; ok: QueryEntry; }; type QueryResult_6 = variant { err: Error; ok: CricMatch__1; }; type QueryResult_5 = variant { err: Error; ok: QueryPool; }; type QueryResult_4 = variant { err: Error; ok: Tournament; }; type QueryResult_3 = variant { err: Error; ok: vec CricMatch__1; }; type QueryResult_2 = variant { err: Error; ok: vec QueryEntry; }; type QueryResult_1 = variant { err: Error; ok: QueryUser; }; type QueryResult = variant { err: Error; ok: vec Tournament; }; type QueryPool = record { availableSpots: nat; closedAt: opt Time; createdAt: Time; entryAmount: nat; entryPerUser: nat; filledSpots: nat; id: PoolId; matchId: text; spots: nat; status: PoolStatus; title: text; }; type QueryEntry = record { entryAt: Time; id: EntryId__1; matchId: text; point: nat; poolId: PoolId; "principal": principal; team: EntryArg; username: text; }; type Position = variant { all; bat; bow; wic; }; type PoolStatus = variant { closed; full; open; }; type PoolId__1 = text; type PoolId = text; type MatchStatus = variant { completed; live; otherReasons: text; upcoming; }; type MatchKey = text; type Error = variant { AnonymousNotAllowed; CantSelectSameTeam: text; EntryNotFound; InsufficientBalance: nat; MatchNotFound; MatchStatusIs: MatchStatus; MaxEntriesInPool: PoolId; NotAController; NotEnoughPlayersInTeam: text; NotYourEntry; PlayerAlreadyExist; PlayerNotFound; PoolNotFound; PoolStatusIs: PoolStatus; TeamAlreadyExists; TeamNotFound: text; TournamentNotFound; UserAlreadyRegistered: record { principal; text; }; UserNotFound; }; type EntryId__1 = text; type EntryId = text; type EntryArg = record { backups: opt vec CPlayer; captian: CPlayer; players: vec CPlayer; viceCaptian: CPlayer; }; type CricMatch__1 = record { association: Association; completedAt: opt Time__1; format: text; gender: text; key: text; messages: vec text; metric_group: text; name: text; short_name: text; sport: text; start_at: nat64; start_at_local: opt nat64; status: text; sub_title: text; teams: record { a: TeamShort; b: TeamShort; }; toss: opt Toss; tournament: TournamentShort; tournamentKey: text; venue: Venue; winner: text; }; type CricMatch = record { association: Association; completedAt: opt Time__1; format: text; gender: text; key: text; messages: vec text; metric_group: text; name: text; short_name: text; sport: text; start_at: nat64; start_at_local: opt nat64; status: text; sub_title: text; teams: record { a: TeamShort; b: TeamShort; }; toss: opt Toss; tournament: TournamentShort; tournamentKey: text; venue: Venue; winner: text; }; type Country = record { code: text; is_region: bool; name: text; official_name: text; short_code: text; }; type Competition = record { code: text; key: text; name: text; }; type CPlayer = record { credit: nat; id: nat; name: text; points: nat; position: Position; team: text; }; type Association = record { code: text; country: opt text; key: opt text; name: text; parent: opt text; }; service : { addMatches: (vec CricMatch__1) -> (QueryResult_8); addTournament: (Tournament) -> (UpdateResult); addTournaments: (vec Tournament) -> (UpdateResult); clearMatches: () -> (QueryResult_8); clearTournaments: () -> (QueryResult_8); deleteMatch: (text) -> (QueryResult_8); fetchController: () -> (vec principal); fetchTournaments: () -> (vec Tournament); getAllContest: () -> (QueryResult_2) query; getEntry: (EntryId) -> (QueryResult_7) query; getLiveContest: () -> (QueryResult_2) query; getLiveMatch: () -> (vec CricMatch) query; getMatch: (MatchKey) -> (QueryResult_6) query; getMatches: () -> (QueryResult_3) query; getPool: (PoolId__1) -> (QueryResult_5) query; getTournament: (text) -> (QueryResult_4) query; getTournamentMatches: (text) -> (QueryResult_3); getUpcomingContest: () -> (QueryResult_2) query; getUpcomingMatch: () -> (vec CricMatch) query; queryUser: () -> (QueryResult_1) query; register: (text) -> (UpdateResult); removeTournament: () -> (QueryResult); updateEntry: (EntryId, EntryArg) -> (UpdateResult); }
export const idlFactory = ({ IDL }) => { const Time__1 = IDL.Int; const TeamShort = IDL.Record({ 'key' : IDL.Text, 'code' : IDL.Text, 'name' : IDL.Text, 'country_code' : IDL.Text, }); const Country = IDL.Record({ 'code' : IDL.Text, 'name' : IDL.Text, 'official_name' : IDL.Text, 'is_region' : IDL.Bool, 'short_code' : IDL.Text, }); const Venue = IDL.Record({ 'key' : IDL.Text, 'geolocation' : IDL.Text, 'country' : Country, 'city' : IDL.Text, 'name' : IDL.Text, }); const Toss = IDL.Record({ 'winner' : IDL.Text, 'called' : IDL.Text, 'elected' : IDL.Text, }); const TournamentShort = IDL.Record({ 'key' : IDL.Text, 'name' : IDL.Text, 'short_name' : IDL.Text, }); const Association = IDL.Record({ 'key' : IDL.Opt(IDL.Text), 'country' : IDL.Opt(IDL.Text), 'code' : IDL.Text, 'name' : IDL.Text, 'parent' : IDL.Opt(IDL.Text), }); const CricMatch__1 = IDL.Record({ 'key' : IDL.Text, 'status' : IDL.Text, 'completedAt' : IDL.Opt(Time__1), 'metric_group' : IDL.Text, 'teams' : IDL.Record({ 'a' : TeamShort, 'b' : TeamShort }), 'venue' : Venue, 'messages' : IDL.Vec(IDL.Text), 'start_at' : IDL.Nat64, 'name' : IDL.Text, 'toss' : IDL.Opt(Toss), 'winner' : IDL.Text, 'tournament' : TournamentShort, 'sport' : IDL.Text, 'gender' : IDL.Text, 'tournamentKey' : IDL.Text, 'start_at_local' : IDL.Opt(IDL.Nat64), 'short_name' : IDL.Text, 'sub_title' : IDL.Text, 'association' : Association, 'format' : IDL.Text, }); const PoolStatus = IDL.Variant({ 'closed' : IDL.Null, 'full' : IDL.Null, 'open' : IDL.Null, }); const PoolId = IDL.Text; const MatchStatus = IDL.Variant({ 'upcoming' : IDL.Null, 'live' : IDL.Null, 'completed' : IDL.Null, 'otherReasons' : IDL.Text, }); const Error = IDL.Variant({ 'PlayerAlreadyExist' : IDL.Null, 'UserAlreadyRegistered' : IDL.Tuple(IDL.Principal, IDL.Text), 'NotAController' : IDL.Null, 'PoolStatusIs' : PoolStatus, 'MaxEntriesInPool' : PoolId, 'EntryNotFound' : IDL.Null, 'PoolNotFound' : IDL.Null, 'NotEnoughPlayersInTeam' : IDL.Text, 'AnonymousNotAllowed' : IDL.Null, 'PlayerNotFound' : IDL.Null, 'InsufficientBalance' : IDL.Nat, 'TeamAlreadyExists' : IDL.Null, 'TeamNotFound' : IDL.Text, 'MatchStatusIs' : MatchStatus, 'TournamentNotFound' : IDL.Null, 'MatchNotFound' : IDL.Null, 'NotYourEntry' : IDL.Null, 'CantSelectSameTeam' : IDL.Text, 'UserNotFound' : IDL.Null, }); const QueryResult_8 = IDL.Variant({ 'ok' : IDL.Text, 'err' : Error }); const Competition = IDL.Record({ 'key' : IDL.Text, 'code' : IDL.Text, 'name' : IDL.Text, }); const Tournament = IDL.Record({ 'key' : IDL.Text, 'metric_group' : IDL.Text, 'name' : IDL.Text, 'association_key' : IDL.Text, 'point_system' : IDL.Text, 'countries' : IDL.Vec(Country), 'start_date' : IDL.Nat64, 'sport' : IDL.Text, 'last_scheduled_match_date' : IDL.Float64, 'competition' : Competition, 'gender' : IDL.Text, 'is_date_confirmed' : IDL.Bool, 'short_name' : IDL.Text, 'is_venue_confirmed' : IDL.Bool, 'formats' : IDL.Vec(IDL.Text), }); const UpdateResult = IDL.Variant({ 'ok' : IDL.Null, 'err' : Error }); const EntryId__1 = IDL.Text; const Position = IDL.Variant({ 'all' : IDL.Null, 'bat' : IDL.Null, 'bow' : IDL.Null, 'wic' : IDL.Null, }); const CPlayer = IDL.Record({ 'id' : IDL.Nat, 'name' : IDL.Text, 'team' : IDL.Text, 'credit' : IDL.Nat, 'position' : Position, 'points' : IDL.Nat, }); const EntryArg = IDL.Record({ 'players' : IDL.Vec(CPlayer), 'captian' : CPlayer, 'viceCaptian' : CPlayer, 'backups' : IDL.Opt(IDL.Vec(CPlayer)), }); const Time = IDL.Int; const QueryEntry = IDL.Record({ 'id' : EntryId__1, 'principal' : IDL.Principal, 'username' : IDL.Text, 'team' : EntryArg, 'entryAt' : Time, 'matchId' : IDL.Text, 'point' : IDL.Nat, 'poolId' : PoolId, }); const QueryResult_2 = IDL.Variant({ 'ok' : IDL.Vec(QueryEntry), 'err' : Error, }); const EntryId = IDL.Text; const QueryResult_7 = IDL.Variant({ 'ok' : QueryEntry, 'err' : Error }); const CricMatch = IDL.Record({ 'key' : IDL.Text, 'status' : IDL.Text, 'completedAt' : IDL.Opt(Time__1), 'metric_group' : IDL.Text, 'teams' : IDL.Record({ 'a' : TeamShort, 'b' : TeamShort }), 'venue' : Venue, 'messages' : IDL.Vec(IDL.Text), 'start_at' : IDL.Nat64, 'name' : IDL.Text, 'toss' : IDL.Opt(Toss), 'winner' : IDL.Text, 'tournament' : TournamentShort, 'sport' : IDL.Text, 'gender' : IDL.Text, 'tournamentKey' : IDL.Text, 'start_at_local' : IDL.Opt(IDL.Nat64), 'short_name' : IDL.Text, 'sub_title' : IDL.Text, 'association' : Association, 'format' : IDL.Text, }); const MatchKey = IDL.Text; const QueryResult_6 = IDL.Variant({ 'ok' : CricMatch__1, 'err' : Error }); const QueryResult_3 = IDL.Variant({ 'ok' : IDL.Vec(CricMatch__1), 'err' : Error, }); const PoolId__1 = IDL.Text; const QueryPool = IDL.Record({ 'id' : PoolId, 'status' : PoolStatus, 'title' : IDL.Text, 'entryAmount' : IDL.Nat, 'createdAt' : Time, 'spots' : IDL.Nat, 'closedAt' : IDL.Opt(Time), 'matchId' : IDL.Text, 'availableSpots' : IDL.Nat, 'entryPerUser' : IDL.Nat, 'filledSpots' : IDL.Nat, }); const QueryResult_5 = IDL.Variant({ 'ok' : QueryPool, 'err' : Error }); const QueryResult_4 = IDL.Variant({ 'ok' : Tournament, 'err' : Error }); const QueryUser = IDL.Record({ 'id' : IDL.Nat, 'upcomingContestNos' : IDL.Nat, 'principal' : IDL.Principal, 'totalEntries' : IDL.Nat, 'balance' : IDL.Nat, 'name' : IDL.Text, 'totalMatchParticipated' : IDL.Nat, 'totalCompletedContest' : IDL.Nat, 'lastEntry' : Time, 'totalPoolParticipated' : IDL.Nat, 'liveContestNos' : IDL.Nat, }); const QueryResult_1 = IDL.Variant({ 'ok' : QueryUser, 'err' : Error }); const QueryResult = IDL.Variant({ 'ok' : IDL.Vec(Tournament), 'err' : Error, }); return IDL.Service({ 'addMatches' : IDL.Func([IDL.Vec(CricMatch__1)], [QueryResult_8], []), 'addTournament' : IDL.Func([Tournament], [UpdateResult], []), 'addTournaments' : IDL.Func([IDL.Vec(Tournament)], [UpdateResult], []), 'clearMatches' : IDL.Func([], [QueryResult_8], []), 'clearTournaments' : IDL.Func([], [QueryResult_8], []), 'deleteMatch' : IDL.Func([IDL.Text], [QueryResult_8], []), 'fetchController' : IDL.Func([], [IDL.Vec(IDL.Principal)], []), 'fetchTournaments' : IDL.Func([], [IDL.Vec(Tournament)], []), 'getAllContest' : IDL.Func([], [QueryResult_2], ['query']), 'getEntry' : IDL.Func([EntryId], [QueryResult_7], ['query']), 'getLiveContest' : IDL.Func([], [QueryResult_2], ['query']), 'getLiveMatch' : IDL.Func([], [IDL.Vec(CricMatch)], ['query']), 'getMatch' : IDL.Func([MatchKey], [QueryResult_6], ['query']), 'getMatches' : IDL.Func([], [QueryResult_3], ['query']), 'getPool' : IDL.Func([PoolId__1], [QueryResult_5], ['query']), 'getTournament' : IDL.Func([IDL.Text], [QueryResult_4], ['query']), 'getTournamentMatches' : IDL.Func([IDL.Text], [QueryResult_3], []), 'getUpcomingContest' : IDL.Func([], [QueryResult_2], ['query']), 'getUpcomingMatch' : IDL.Func([], [IDL.Vec(CricMatch)], ['query']), 'queryUser' : IDL.Func([], [QueryResult_1], ['query']), 'register' : IDL.Func([IDL.Text], [UpdateResult], []), 'removeTournament' : IDL.Func([], [QueryResult], []), 'updateEntry' : IDL.Func([EntryId, EntryArg], [UpdateResult], []), }); }; export const init = ({ IDL }) => { return []; };
one more request for the d.js file
both are there above .did and .did.js from .dfx
or its some other js file
both are there above .did and .did.js from .dfx
or its some other js file
should be an interface file if you use didc bind file.did -t ts > file.d.ts
import type { ActorMethod } from '@dfinity/agent';
export interface Association {
'key' : [] | [string],
'country' : [] | [string],
'code' : string,
'name' : string,
'parent' : [] | [string],
}
export interface CPlayer {
'id' : bigint,
'name' : string,
'team' : string,
'credit' : bigint,
'position' : Position,
'points' : bigint,
}
export interface Competition {
'key' : string,
'code' : string,
'name' : string,
}
export interface Country {
'code' : string,
'name' : string,
'official_name' : string,
'is_region' : boolean,
'short_code' : string,
}
export interface CricMatch {
'key' : string,
'status' : string,
'completedAt' : [] | [Time__1],
'metric_group' : string,
'teams' : { 'a' : TeamShort, 'b' : TeamShort },
'venue' : Venue,
'messages' : Array<string>,
'start_at' : bigint,
'name' : string,
'toss' : [] | [Toss],
'winner' : string,
'tournament' : TournamentShort,
'sport' : string,
'gender' : string,
'tournamentKey' : string,
'start_at_local' : [] | [bigint],
'short_name' : string,
'sub_title' : string,
'association' : Association,
'format' : string,
}
export interface CricMatch__1 {
'key' : string,
'status' : string,
'completedAt' : [] | [Time__1],
'metric_group' : string,
'teams' : { 'a' : TeamShort, 'b' : TeamShort },
'venue' : Venue,
'messages' : Array<string>,
'start_at' : bigint,
'name' : string,
'toss' : [] | [Toss],
'winner' : string,
'tournament' : TournamentShort,
'sport' : string,
'gender' : string,
'tournamentKey' : string,
'start_at_local' : [] | [bigint],
'short_name' : string,
'sub_title' : string,
'association' : Association,
'format' : string,
}
export interface EntryArg {
'players' : Array<CPlayer>,
'captian' : CPlayer,
'viceCaptian' : CPlayer,
'backups' : [] | [Array<CPlayer>],
}
export type EntryId = string;
export type EntryId__1 = string;
export type Error = { 'PlayerAlreadyExist' : null } |
{ 'UserAlreadyRegistered' : [Principal, string] } |
{ 'NotAController' : null } |
{ 'PoolStatusIs' : PoolStatus } |
{ 'MaxEntriesInPool' : PoolId } |
{ 'EntryNotFound' : null } |
{ 'PoolNotFound' : null } |
{ 'NotEnoughPlayersInTeam' : string } |
{ 'AnonymousNotAllowed' : null } |
{ 'PlayerNotFound' : null } |
{ 'InsufficientBalance' : bigint } |
{ 'TeamAlreadyExists' : null } |
{ 'TeamNotFound' : string } |
{ 'MatchStatusIs' : MatchStatus } |
{ 'TournamentNotFound' : null } |
{ 'MatchNotFound' : null } |
{ 'NotYourEntry' : null } |
{ 'CantSelectSameTeam' : string } |
{ 'UserNotFound' : null };
export type MatchKey = string;
export type MatchStatus = { 'upcoming' : null } |
{ 'live' : null } |
{ 'completed' : null } |
{ 'otherReasons' : string };
export type PoolId = string;
export type PoolId__1 = string;
export type PoolStatus = { 'closed' : null } |
{ 'full' : null } |
{ 'open' : null };
export type Position = { 'all' : null } |
{ 'bat' : null } |
{ 'bow' : null } |
{ 'wic' : null };
export interface QueryEntry {
'id' : EntryId__1,
'principal' : Principal,
'username' : string,
'team' : EntryArg,
'entryAt' : Time,
'matchId' : string,
'point' : bigint,
'poolId' : PoolId,
}
export interface QueryPool {
'id' : PoolId,
'status' : PoolStatus,
'title' : string,
'entryAmount' : bigint,
'createdAt' : Time,
'spots' : bigint,
'closedAt' : [] | [Time],
'matchId' : string,
'availableSpots' : bigint,
'entryPerUser' : bigint,
'filledSpots' : bigint,
}
export type QueryResult = { 'ok' : Array<Tournament> } |
{ 'err' : Error };
export type QueryResult_1 = { 'ok' : QueryUser } |
{ 'err' : Error };
export type QueryResult_2 = { 'ok' : Array<QueryEntry> } |
{ 'err' : Error };
export type QueryResult_3 = { 'ok' : Array<CricMatch__1> } |
{ 'err' : Error };
export type QueryResult_4 = { 'ok' : Tournament } |
{ 'err' : Error };
export type QueryResult_5 = { 'ok' : QueryPool } |
{ 'err' : Error };
export type QueryResult_6 = { 'ok' : CricMatch__1 } |
{ 'err' : Error };
export type QueryResult_7 = { 'ok' : QueryEntry } |
{ 'err' : Error };
export type QueryResult_8 = { 'ok' : string } |
{ 'err' : Error };
export interface QueryUser {
'id' : bigint,
'upcomingContestNos' : bigint,
'principal' : Principal,
'totalEntries' : bigint,
'balance' : bigint,
'name' : string,
'totalMatchParticipated' : bigint,
'totalCompletedContest' : bigint,
'lastEntry' : Time,
'totalPoolParticipated' : bigint,
'liveContestNos' : bigint,
}
export interface TeamShort {
'key' : string,
'code' : string,
'name' : string,
'country_code' : string,
}
export type Time = bigint;
export type Time__1 = bigint;
export interface Toss {
'winner' : string,
'called' : string,
'elected' : string,
}
export interface Tournament {
'key' : string,
'metric_group' : string,
'name' : string,
'association_key' : string,
'point_system' : string,
'countries' : Array<Country>,
'start_date' : bigint,
'sport' : string,
'last_scheduled_match_date' : number,
'competition' : Competition,
'gender' : string,
'is_date_confirmed' : boolean,
'short_name' : string,
'is_venue_confirmed' : boolean,
'formats' : Array<string>,
}
export interface TournamentShort {
'key' : string,
'name' : string,
'short_name' : string,
}
export type UpdateResult = { 'ok' : null } |
{ 'err' : Error };
export interface Venue {
'key' : string,
'geolocation' : string,
'country' : Country,
'city' : string,
'name' : string,
}
export interface _SERVICE {
'addMatches' : ActorMethod<[Array<CricMatch__1>], QueryResult_8>,
'addTournament' : ActorMethod<[Tournament], UpdateResult>,
'addTournaments' : ActorMethod<[Array<Tournament>], UpdateResult>,
'clearMatches' : ActorMethod<[], QueryResult_8>,
'clearTournaments' : ActorMethod<[], QueryResult_8>,
'deleteMatch' : ActorMethod<[string], QueryResult_8>,
'fetchController' : ActorMethod<[], Array<Principal>>,
'fetchTournaments' : ActorMethod<[], Array<Tournament>>,
'getAllContest' : ActorMethod<[], QueryResult_2>,
'getEntry' : ActorMethod<[EntryId], QueryResult_7>,
'getLiveContest' : ActorMethod<[], QueryResult_2>,
'getLiveMatch' : ActorMethod<[], Array<CricMatch>>,
'getMatch' : ActorMethod<[MatchKey], QueryResult_6>,
'getMatches' : ActorMethod<[], QueryResult_3>,
'getPool' : ActorMethod<[PoolId__1], QueryResult_5>,
'getTournament' : ActorMethod<[string], QueryResult_4>,
'getTournamentMatches' : ActorMethod<[string], QueryResult_3>,
'getUpcomingContest' : ActorMethod<[], QueryResult_2>,
'getUpcomingMatch' : ActorMethod<[], Array<CricMatch>>,
'queryUser' : ActorMethod<[], QueryResult_1>,
'register' : ActorMethod<[string], UpdateResult>,
'removeTournament' : ActorMethod<[], QueryResult>,
'updateEntry' : ActorMethod<[EntryId, EntryArg], UpdateResult>,
}
export interface Association {
'key' : [] | [string],
'country' : [] | [string],
'code' : string,
'name' : string,
'parent' : [] | [string],
}
see above, in JS/TS conversion, opt variable
will be decoded as [] | [type]
candid_dart is also following this standard. so List
will be returned if it is opt
type. Should not be null
by default
So I assume you have two situations here:
opt variable
in canister function outcomeopt variable
from dartWhich situation are you in?
Could you please post the code for how you call the canister?
Like this.
i am adding CricMatch to canister.
class IcCricketService {
AgentFactory? _agentFactory;
CanisterActor? get actor => _agentFactory?.actor;
Future<void> setAgent() async {
_agentFactory ??= await AgentFactory.createAgent(
canisterId: Constants.cricCanister,
url: Constants.icp,
idl: IcCricketIDL.idl,
// identity: newIdentity,
debug: true,
);
}
Future<QueryResult8> addMatchesForTournament(List<CricMatch> matches) async {
return IcCricketIDLActor.addMatches(actor!, matches);
}
Future<QueryResult3> getMatches() async {
return IcCricketIDLActor.getMatches(actor!);
}
}
When using the fromJson
constructor, note that it can only be applied to requests and responses from agent_dart
, and cannot manually create Map
as parameters passed to fromJson
, because it uses candid
deserialization. Here is an example I wrote based on your code for your reference:
Future<void> test() async {
final service = IcCricketIDLService(
canisterId: Constants.cricCanister,
uri: Uri.parse(Constants.icp),
// identity: newIdentity,
debug: true,
);
final ret = await service.addMatches(
[
CricMatch(
association: Association(code: '1', name: 'a'),
// ...
),
],
);
print('ret: $ret');
final v = await service.getMatches();
print('v: $v');
}
// coverage:ignore-file
// ignore_for_file: type=lint, unnecessary_null_comparison, unnecessary_non_null_assertion, unused_field
// ======================================
// GENERATED CODE - DO NOT MODIFY BY HAND
// ======================================
import 'dart:async';
import 'package:agent_dart/agent_dart.dart';
import 'package:collection/collection.dart';
import 'package:meta/meta.dart';
class IcCricketIDLActor {
const IcCricketIDLActor._();
/// ```Candid
/// addMatches: (vec CricMatch__1) -> (QueryResult_8)
/// ```
static Future<QueryResult8> addMatches(
CanisterActor actor,
List<CricMatch1> arg,
) async {
final request = [arg];
const method = 'addMatches';
final response = await actor.getFunc(method)!(request);
return QueryResult8.fromJson(response);
}
/// ```Candid
/// addTournament: (Tournament) -> (UpdateResult)
/// ```
static Future<UpdateResult> addTournament(
CanisterActor actor,
Tournament arg,
) async {
final request = [arg];
const method = 'addTournament';
final response = await actor.getFunc(method)!(request);
return UpdateResult.fromJson(response);
}
/// ```Candid
/// addTournaments: (vec Tournament) -> (UpdateResult)
/// ```
static Future<UpdateResult> addTournaments(
CanisterActor actor,
List<Tournament> arg,
) async {
final request = [arg];
const method = 'addTournaments';
final response = await actor.getFunc(method)!(request);
return UpdateResult.fromJson(response);
}
/// ```Candid
/// clearMatches: () -> (QueryResult_8)
/// ```
static Future<QueryResult8> clearMatches(
CanisterActor actor,
) async {
const request = [];
const method = 'clearMatches';
final response = await actor.getFunc(method)!(request);
return QueryResult8.fromJson(response);
}
/// ```Candid
/// clearTournaments: () -> (QueryResult_8)
/// ```
static Future<QueryResult8> clearTournaments(
CanisterActor actor,
) async {
const request = [];
const method = 'clearTournaments';
final response = await actor.getFunc(method)!(request);
return QueryResult8.fromJson(response);
}
/// ```Candid
/// deleteMatch: (text) -> (QueryResult_8)
/// ```
static Future<QueryResult8> deleteMatch(
CanisterActor actor,
String arg,
) async {
final request = [arg];
const method = 'deleteMatch';
final response = await actor.getFunc(method)!(request);
return QueryResult8.fromJson(response);
}
/// ```Candid
/// fetchController: () -> (vec principal)
/// ```
static Future<List<Principal>> fetchController(
CanisterActor actor,
) async {
const request = [];
const method = 'fetchController';
final response = await actor.getFunc(method)!(request);
return (response as List).map((e) {
return Principal.from(e);
}).toList();
}
/// ```Candid
/// fetchTournaments: () -> (vec Tournament)
/// ```
static Future<List<Tournament>> fetchTournaments(
CanisterActor actor,
) async {
const request = [];
const method = 'fetchTournaments';
final response = await actor.getFunc(method)!(request);
return (response as List).map((e) {
return Tournament.fromJson(e);
}).toList();
}
/// ```Candid
/// getAllContest: () -> (QueryResult_2) query
/// ```
static Future<QueryResult2> getAllContest(
CanisterActor actor,
) async {
const request = [];
const method = 'getAllContest';
final response = await actor.getFunc(method)!(request);
return QueryResult2.fromJson(response);
}
/// ```Candid
/// getEntry: (EntryId) -> (QueryResult_7) query
/// ```
static Future<QueryResult7> getEntry(
CanisterActor actor,
EntryId arg,
) async {
final request = [arg];
const method = 'getEntry';
final response = await actor.getFunc(method)!(request);
return QueryResult7.fromJson(response);
}
/// ```Candid
/// getLiveContest: () -> (QueryResult_2) query
/// ```
static Future<QueryResult2> getLiveContest(
CanisterActor actor,
) async {
const request = [];
const method = 'getLiveContest';
final response = await actor.getFunc(method)!(request);
return QueryResult2.fromJson(response);
}
/// ```Candid
/// getLiveMatch: () -> (vec CricMatch) query
/// ```
static Future<List<CricMatch>> getLiveMatch(
CanisterActor actor,
) async {
const request = [];
const method = 'getLiveMatch';
final response = await actor.getFunc(method)!(request);
return (response as List).map((e) {
return CricMatch.fromJson(e);
}).toList();
}
/// ```Candid
/// getMatch: (MatchKey) -> (QueryResult_6) query
/// ```
static Future<QueryResult6> getMatch(
CanisterActor actor,
MatchKey arg,
) async {
final request = [arg];
const method = 'getMatch';
final response = await actor.getFunc(method)!(request);
return QueryResult6.fromJson(response);
}
/// ```Candid
/// getMatches: () -> (QueryResult_3) query
/// ```
static Future<QueryResult3> getMatches(
CanisterActor actor,
) async {
const request = [];
const method = 'getMatches';
final response = await actor.getFunc(method)!(request);
return QueryResult3.fromJson(response);
}
/// ```Candid
/// getPool: (PoolId__1) -> (QueryResult_5) query
/// ```
static Future<QueryResult5> getPool(
CanisterActor actor,
PoolId1 arg,
) async {
final request = [arg];
const method = 'getPool';
final response = await actor.getFunc(method)!(request);
return QueryResult5.fromJson(response);
}
/// ```Candid
/// getTournament: (text) -> (QueryResult_4) query
/// ```
static Future<QueryResult4> getTournament(
CanisterActor actor,
String arg,
) async {
final request = [arg];
const method = 'getTournament';
final response = await actor.getFunc(method)!(request);
return QueryResult4.fromJson(response);
}
/// ```Candid
/// getTournamentMatches: (text) -> (QueryResult_3)
/// ```
static Future<QueryResult3> getTournamentMatches(
CanisterActor actor,
String arg,
) async {
final request = [arg];
const method = 'getTournamentMatches';
final response = await actor.getFunc(method)!(request);
return QueryResult3.fromJson(response);
}
/// ```Candid
/// getUpcomingContest: () -> (QueryResult_2) query
/// ```
static Future<QueryResult2> getUpcomingContest(
CanisterActor actor,
) async {
const request = [];
const method = 'getUpcomingContest';
final response = await actor.getFunc(method)!(request);
return QueryResult2.fromJson(response);
}
/// ```Candid
/// getUpcomingMatch: () -> (vec CricMatch) query
/// ```
static Future<List<CricMatch>> getUpcomingMatch(
CanisterActor actor,
) async {
const request = [];
const method = 'getUpcomingMatch';
final response = await actor.getFunc(method)!(request);
return (response as List).map((e) {
return CricMatch.fromJson(e);
}).toList();
}
/// ```Candid
/// queryUser: () -> (QueryResult_1) query
/// ```
static Future<QueryResult1> queryUser(
CanisterActor actor,
) async {
const request = [];
const method = 'queryUser';
final response = await actor.getFunc(method)!(request);
return QueryResult1.fromJson(response);
}
/// ```Candid
/// register: (text) -> (UpdateResult)
/// ```
static Future<UpdateResult> register(
CanisterActor actor,
String arg,
) async {
final request = [arg];
const method = 'register';
final response = await actor.getFunc(method)!(request);
return UpdateResult.fromJson(response);
}
/// ```Candid
/// removeTournament: () -> (QueryResult)
/// ```
static Future<QueryResult> removeTournament(
CanisterActor actor,
) async {
const request = [];
const method = 'removeTournament';
final response = await actor.getFunc(method)!(request);
return QueryResult.fromJson(response);
}
/// ```Candid
/// updateEntry: (EntryId, EntryArg) -> (UpdateResult)
/// ```
static Future<UpdateResult> updateEntry(
CanisterActor actor,
UpdateEntryArg arg,
) async {
final request = arg.toJson();
const method = 'updateEntry';
final response = await actor.getFunc(method)!(request);
return UpdateResult.fromJson(response);
}
}
class IcCricketIDLService {
IcCricketIDLService({
required this.canisterId,
required this.uri,
this.identity,
this.createActorMethod,
this.debug = true,
}) : idl = IcCricketIDL.idl;
final String canisterId;
final Uri uri;
final Service idl;
final Identity? identity;
final bool debug;
final CreateActorMethod? createActorMethod;
Completer<CanisterActor>? _actor;
Future<CanisterActor> getActor() {
if (_actor != null) {
return _actor!.future;
}
final completer = Completer<CanisterActor>();
_actor = completer;
Future(() async {
final httpAgent = HttpAgent(
defaultProtocol: uri.scheme,
defaultHost: uri.host,
defaultPort: uri.port,
options: HttpAgentOptions(identity: identity),
);
if (debug) {
await httpAgent.fetchRootKey();
}
httpAgent.addTransform(
HttpAgentRequestTransformFn(call: makeNonceTransform()),
);
return CanisterActor(
ActorConfig(
canisterId: Principal.fromText(canisterId),
agent: httpAgent,
),
idl,
createActorMethod: createActorMethod,
);
}).then(completer.complete).catchError((e, s) {
completer.completeError(e, s);
_actor = null;
});
return completer.future;
}
/// ```Candid
/// addMatches: (vec CricMatch__1) -> (QueryResult_8)
/// ```
Future<QueryResult8> addMatches(
List<CricMatch1> arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.addMatches(
actor,
arg,
);
}
/// ```Candid
/// addTournament: (Tournament) -> (UpdateResult)
/// ```
Future<UpdateResult> addTournament(
Tournament arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.addTournament(
actor,
arg,
);
}
/// ```Candid
/// addTournaments: (vec Tournament) -> (UpdateResult)
/// ```
Future<UpdateResult> addTournaments(
List<Tournament> arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.addTournaments(
actor,
arg,
);
}
/// ```Candid
/// clearMatches: () -> (QueryResult_8)
/// ```
Future<QueryResult8> clearMatches() async {
final actor = await getActor();
return IcCricketIDLActor.clearMatches(
actor,
);
}
/// ```Candid
/// clearTournaments: () -> (QueryResult_8)
/// ```
Future<QueryResult8> clearTournaments() async {
final actor = await getActor();
return IcCricketIDLActor.clearTournaments(
actor,
);
}
/// ```Candid
/// deleteMatch: (text) -> (QueryResult_8)
/// ```
Future<QueryResult8> deleteMatch(
String arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.deleteMatch(
actor,
arg,
);
}
/// ```Candid
/// fetchController: () -> (vec principal)
/// ```
Future<List<Principal>> fetchController() async {
final actor = await getActor();
return IcCricketIDLActor.fetchController(
actor,
);
}
/// ```Candid
/// fetchTournaments: () -> (vec Tournament)
/// ```
Future<List<Tournament>> fetchTournaments() async {
final actor = await getActor();
return IcCricketIDLActor.fetchTournaments(
actor,
);
}
/// ```Candid
/// getAllContest: () -> (QueryResult_2) query
/// ```
Future<QueryResult2> getAllContest() async {
final actor = await getActor();
return IcCricketIDLActor.getAllContest(
actor,
);
}
/// ```Candid
/// getEntry: (EntryId) -> (QueryResult_7) query
/// ```
Future<QueryResult7> getEntry(
EntryId arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.getEntry(
actor,
arg,
);
}
/// ```Candid
/// getLiveContest: () -> (QueryResult_2) query
/// ```
Future<QueryResult2> getLiveContest() async {
final actor = await getActor();
return IcCricketIDLActor.getLiveContest(
actor,
);
}
/// ```Candid
/// getLiveMatch: () -> (vec CricMatch) query
/// ```
Future<List<CricMatch>> getLiveMatch() async {
final actor = await getActor();
return IcCricketIDLActor.getLiveMatch(
actor,
);
}
/// ```Candid
/// getMatch: (MatchKey) -> (QueryResult_6) query
/// ```
Future<QueryResult6> getMatch(
MatchKey arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.getMatch(
actor,
arg,
);
}
/// ```Candid
/// getMatches: () -> (QueryResult_3) query
/// ```
Future<QueryResult3> getMatches() async {
final actor = await getActor();
return IcCricketIDLActor.getMatches(
actor,
);
}
/// ```Candid
/// getPool: (PoolId__1) -> (QueryResult_5) query
/// ```
Future<QueryResult5> getPool(
PoolId1 arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.getPool(
actor,
arg,
);
}
/// ```Candid
/// getTournament: (text) -> (QueryResult_4) query
/// ```
Future<QueryResult4> getTournament(
String arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.getTournament(
actor,
arg,
);
}
/// ```Candid
/// getTournamentMatches: (text) -> (QueryResult_3)
/// ```
Future<QueryResult3> getTournamentMatches(
String arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.getTournamentMatches(
actor,
arg,
);
}
/// ```Candid
/// getUpcomingContest: () -> (QueryResult_2) query
/// ```
Future<QueryResult2> getUpcomingContest() async {
final actor = await getActor();
return IcCricketIDLActor.getUpcomingContest(
actor,
);
}
/// ```Candid
/// getUpcomingMatch: () -> (vec CricMatch) query
/// ```
Future<List<CricMatch>> getUpcomingMatch() async {
final actor = await getActor();
return IcCricketIDLActor.getUpcomingMatch(
actor,
);
}
/// ```Candid
/// queryUser: () -> (QueryResult_1) query
/// ```
Future<QueryResult1> queryUser() async {
final actor = await getActor();
return IcCricketIDLActor.queryUser(
actor,
);
}
/// ```Candid
/// register: (text) -> (UpdateResult)
/// ```
Future<UpdateResult> register(
String arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.register(
actor,
arg,
);
}
/// ```Candid
/// removeTournament: () -> (QueryResult)
/// ```
Future<QueryResult> removeTournament() async {
final actor = await getActor();
return IcCricketIDLActor.removeTournament(
actor,
);
}
/// ```Candid
/// updateEntry: (EntryId, EntryArg) -> (UpdateResult)
/// ```
Future<UpdateResult> updateEntry(
UpdateEntryArg arg,
) async {
final actor = await getActor();
return IcCricketIDLActor.updateEntry(
actor,
arg,
);
}
}
class IcCricketIDL {
const IcCricketIDL._();
/// [_Venue] defined in Candid
/// ```Candid
/// type Venue = record { city: text; country: Country; geolocation: text; key: text; name: text };
/// ```
static final RecordClass _Venue = IDL.Record({
'city': IDL.Text,
'country': _Country,
'geolocation': IDL.Text,
'key': IDL.Text,
'name': IDL.Text,
});
/// [_UpdateResult] defined in Candid
/// ```Candid
/// type UpdateResult = variant { err: Error; ok };
/// ```
static final VariantClass _UpdateResult = IDL.Variant({
'err': _Error,
'ok': IDL.Null,
});
/// [_TournamentShort] defined in Candid
/// ```Candid
/// type TournamentShort = record { key: text; name: text; short_name: text };
/// ```
static final RecordClass _TournamentShort = IDL.Record({
'key': IDL.Text,
'name': IDL.Text,
'short_name': IDL.Text,
});
/// [_Tournament] defined in Candid
/// ```Candid
/// type Tournament = record { association_key: text; competition: Competition; countries: vec Country; formats: vec text; gender: text; is_date_confirmed: bool; is_venue_confirmed: bool; key: text; last_scheduled_match_date: float64; metric_group: text; name: text; point_system: text; short_name: text; sport: text; start_date: nat64 };
/// ```
static final RecordClass _Tournament = IDL.Record({
'association_key': IDL.Text,
'competition': _Competition,
'countries': IDL.Vec(
_Country,
),
'formats': IDL.Vec(
IDL.Text,
),
'gender': IDL.Text,
'is_date_confirmed': IDL.Bool,
'is_venue_confirmed': IDL.Bool,
'key': IDL.Text,
'last_scheduled_match_date': IDL.Float64,
'metric_group': IDL.Text,
'name': IDL.Text,
'point_system': IDL.Text,
'short_name': IDL.Text,
'sport': IDL.Text,
'start_date': IDL.Nat64,
});
/// [_Toss] defined in Candid
/// ```Candid
/// type Toss = record { called: text; elected: text; winner: text };
/// ```
static final RecordClass _Toss = IDL.Record({
'called': IDL.Text,
'elected': IDL.Text,
'winner': IDL.Text,
});
/// [_Time__1] defined in Candid
/// ```Candid
/// type Time__1 = int;
/// ```
static final _Time__1 = IDL.Int;
/// [_Time] defined in Candid
/// ```Candid
/// type Time = int;
/// ```
static final _Time = IDL.Int;
/// [_TeamShort] defined in Candid
/// ```Candid
/// type TeamShort = record { code: text; country_code: text; key: text; name: text };
/// ```
static final RecordClass _TeamShort = IDL.Record({
'code': IDL.Text,
'country_code': IDL.Text,
'key': IDL.Text,
'name': IDL.Text,
});
/// [_QueryUser] defined in Candid
/// ```Candid
/// type QueryUser = record { balance: nat; id: nat; lastEntry: Time; liveContestNos: nat; name: text; principal: principal; totalCompletedContest: nat; totalEntries: nat; totalMatchParticipated: nat; totalPoolParticipated: nat; upcomingContestNos: nat };
/// ```
static final RecordClass _QueryUser = IDL.Record({
'balance': IDL.Nat,
'id': IDL.Nat,
'lastEntry': _Time,
'liveContestNos': IDL.Nat,
'name': IDL.Text,
'principal': IDL.Principal,
'totalCompletedContest': IDL.Nat,
'totalEntries': IDL.Nat,
'totalMatchParticipated': IDL.Nat,
'totalPoolParticipated': IDL.Nat,
'upcomingContestNos': IDL.Nat,
});
/// [_QueryResult_8] defined in Candid
/// ```Candid
/// type QueryResult_8 = variant { err: Error; ok: text };
/// ```
static final VariantClass _QueryResult_8 = IDL.Variant({
'err': _Error,
'ok': IDL.Text,
});
/// [_QueryResult_7] defined in Candid
/// ```Candid
/// type QueryResult_7 = variant { err: Error; ok: QueryEntry };
/// ```
static final VariantClass _QueryResult_7 = IDL.Variant({
'err': _Error,
'ok': _QueryEntry,
});
/// [_QueryResult_6] defined in Candid
/// ```Candid
/// type QueryResult_6 = variant { err: Error; ok: CricMatch__1 };
/// ```
static final VariantClass _QueryResult_6 = IDL.Variant({
'err': _Error,
'ok': _CricMatch__1,
});
/// [_QueryResult_5] defined in Candid
/// ```Candid
/// type QueryResult_5 = variant { err: Error; ok: QueryPool };
/// ```
static final VariantClass _QueryResult_5 = IDL.Variant({
'err': _Error,
'ok': _QueryPool,
});
/// [_QueryResult_4] defined in Candid
/// ```Candid
/// type QueryResult_4 = variant { err: Error; ok: Tournament };
/// ```
static final VariantClass _QueryResult_4 = IDL.Variant({
'err': _Error,
'ok': _Tournament,
});
/// [_QueryResult_3] defined in Candid
/// ```Candid
/// type QueryResult_3 = variant { err: Error; ok: vec CricMatch__1 };
/// ```
static final VariantClass _QueryResult_3 = IDL.Variant({
'err': _Error,
'ok': IDL.Vec(
_CricMatch__1,
),
});
/// [_QueryResult_2] defined in Candid
/// ```Candid
/// type QueryResult_2 = variant { err: Error; ok: vec QueryEntry };
/// ```
static final VariantClass _QueryResult_2 = IDL.Variant({
'err': _Error,
'ok': IDL.Vec(
_QueryEntry,
),
});
/// [_QueryResult_1] defined in Candid
/// ```Candid
/// type QueryResult_1 = variant { err: Error; ok: QueryUser };
/// ```
static final VariantClass _QueryResult_1 = IDL.Variant({
'err': _Error,
'ok': _QueryUser,
});
/// [_QueryResult] defined in Candid
/// ```Candid
/// type QueryResult = variant { err: Error; ok: vec Tournament };
/// ```
static final VariantClass _QueryResult = IDL.Variant({
'err': _Error,
'ok': IDL.Vec(
_Tournament,
),
});
/// [_QueryPool] defined in Candid
/// ```Candid
/// type QueryPool = record { availableSpots: nat; closedAt: opt Time; createdAt: Time; entryAmount: nat; entryPerUser: nat; filledSpots: nat; id: PoolId; matchId: text; spots: nat; status: PoolStatus; title: text };
/// ```
static final RecordClass _QueryPool = IDL.Record({
'availableSpots': IDL.Nat,
'closedAt': IDL.Opt(
_Time,
),
'createdAt': _Time,
'entryAmount': IDL.Nat,
'entryPerUser': IDL.Nat,
'filledSpots': IDL.Nat,
'id': _PoolId,
'matchId': IDL.Text,
'spots': IDL.Nat,
'status': _PoolStatus,
'title': IDL.Text,
});
/// [_QueryEntry] defined in Candid
/// ```Candid
/// type QueryEntry = record { entryAt: Time; id: EntryId__1; matchId: text; point: nat; poolId: PoolId; principal: principal; team: EntryArg; username: text };
/// ```
static final RecordClass _QueryEntry = IDL.Record({
'entryAt': _Time,
'id': _EntryId__1,
'matchId': IDL.Text,
'point': IDL.Nat,
'poolId': _PoolId,
'principal': IDL.Principal,
'team': _EntryArg,
'username': IDL.Text,
});
/// [_Position] defined in Candid
/// ```Candid
/// type Position = variant { all; bat; bow; wic };
/// ```
static final VariantClass _Position = IDL.Variant({
'all': IDL.Null,
'bat': IDL.Null,
'bow': IDL.Null,
'wic': IDL.Null,
});
/// [_PoolStatus] defined in Candid
/// ```Candid
/// type PoolStatus = variant { closed; full; open };
/// ```
static final VariantClass _PoolStatus = IDL.Variant({
'closed': IDL.Null,
'full': IDL.Null,
'open': IDL.Null,
});
/// [_PoolId__1] defined in Candid
/// ```Candid
/// type PoolId__1 = text;
/// ```
static final _PoolId__1 = IDL.Text;
/// [_PoolId] defined in Candid
/// ```Candid
/// type PoolId = text;
/// ```
static final _PoolId = IDL.Text;
/// [_MatchStatus] defined in Candid
/// ```Candid
/// type MatchStatus = variant { completed; live; otherReasons: text; upcoming };
/// ```
static final VariantClass _MatchStatus = IDL.Variant({
'completed': IDL.Null,
'live': IDL.Null,
'otherReasons': IDL.Text,
'upcoming': IDL.Null,
});
/// [_MatchKey] defined in Candid
/// ```Candid
/// type MatchKey = text;
/// ```
static final _MatchKey = IDL.Text;
/// [_Error] defined in Candid
/// ```Candid
/// type Error = variant { AnonymousNotAllowed; CantSelectSameTeam: text; EntryNotFound; InsufficientBalance: nat; MatchNotFound; MatchStatusIs: MatchStatus; MaxEntriesInPool: PoolId; NotAController; NotEnoughPlayersInTeam: text; NotYourEntry; PlayerAlreadyExist; PlayerNotFound; PoolNotFound; PoolStatusIs: PoolStatus; TeamAlreadyExists; TeamNotFound: text; TournamentNotFound; UserAlreadyRegistered: record { principal; text }; UserNotFound };
/// ```
static final VariantClass _Error = IDL.Variant({
'AnonymousNotAllowed': IDL.Null,
'CantSelectSameTeam': IDL.Text,
'EntryNotFound': IDL.Null,
'InsufficientBalance': IDL.Nat,
'MatchNotFound': IDL.Null,
'MatchStatusIs': _MatchStatus,
'MaxEntriesInPool': _PoolId,
'NotAController': IDL.Null,
'NotEnoughPlayersInTeam': IDL.Text,
'NotYourEntry': IDL.Null,
'PlayerAlreadyExist': IDL.Null,
'PlayerNotFound': IDL.Null,
'PoolNotFound': IDL.Null,
'PoolStatusIs': _PoolStatus,
'TeamAlreadyExists': IDL.Null,
'TeamNotFound': IDL.Text,
'TournamentNotFound': IDL.Null,
'UserAlreadyRegistered': IDL.Tuple([
IDL.Principal,
IDL.Text,
]),
'UserNotFound': IDL.Null,
});
/// [_EntryId__1] defined in Candid
/// ```Candid
/// type EntryId__1 = text;
/// ```
static final _EntryId__1 = IDL.Text;
/// [_EntryId] defined in Candid
/// ```Candid
/// type EntryId = text;
/// ```
static final _EntryId = IDL.Text;
/// [_EntryArg] defined in Candid
/// ```Candid
/// type EntryArg = record { backups: opt vec CPlayer; captian: CPlayer; players: vec CPlayer; viceCaptian: CPlayer };
/// ```
static final RecordClass _EntryArg = IDL.Record({
'backups': IDL.Opt(
IDL.Vec(
_CPlayer,
),
),
'captian': _CPlayer,
'players': IDL.Vec(
_CPlayer,
),
'viceCaptian': _CPlayer,
});
/// [_CricMatch__1] defined in Candid
/// ```Candid
/// type CricMatch__1 = record { association: Association; completedAt: opt Time__1; format: text; gender: text; key: text; messages: vec text; metric_group: text; name: text; short_name: text; sport: text; start_at: nat64; start_at_local: opt nat64; status: text; sub_title: text; teams: record { a: TeamShort; b: TeamShort }; toss: opt Toss; tournament: TournamentShort; tournamentKey: text; venue: Venue; winner: text };
/// ```
static final RecordClass _CricMatch__1 = IDL.Record({
'association': _Association,
'completedAt': IDL.Opt(
_Time__1,
),
'format': IDL.Text,
'gender': IDL.Text,
'key': IDL.Text,
'messages': IDL.Vec(
IDL.Text,
),
'metric_group': IDL.Text,
'name': IDL.Text,
'short_name': IDL.Text,
'sport': IDL.Text,
'start_at': IDL.Nat64,
'start_at_local': IDL.Opt(
IDL.Nat64,
),
'status': IDL.Text,
'sub_title': IDL.Text,
'teams': IDL.Record({
'a': _TeamShort,
'b': _TeamShort,
}),
'toss': IDL.Opt(
_Toss,
),
'tournament': _TournamentShort,
'tournamentKey': IDL.Text,
'venue': _Venue,
'winner': IDL.Text,
});
/// [_CricMatch] defined in Candid
/// ```Candid
/// type CricMatch = record { association: Association; completedAt: opt Time__1; format: text; gender: text; key: text; messages: vec text; metric_group: text; name: text; short_name: text; sport: text; start_at: nat64; start_at_local: opt nat64; status: text; sub_title: text; teams: record { a: TeamShort; b: TeamShort }; toss: opt Toss; tournament: TournamentShort; tournamentKey: text; venue: Venue; winner: text };
/// ```
static final RecordClass _CricMatch = IDL.Record({
'association': _Association,
'completedAt': IDL.Opt(
_Time__1,
),
'format': IDL.Text,
'gender': IDL.Text,
'key': IDL.Text,
'messages': IDL.Vec(
IDL.Text,
),
'metric_group': IDL.Text,
'name': IDL.Text,
'short_name': IDL.Text,
'sport': IDL.Text,
'start_at': IDL.Nat64,
'start_at_local': IDL.Opt(
IDL.Nat64,
),
'status': IDL.Text,
'sub_title': IDL.Text,
'teams': IDL.Record({
'a': _TeamShort,
'b': _TeamShort,
}),
'toss': IDL.Opt(
_Toss,
),
'tournament': _TournamentShort,
'tournamentKey': IDL.Text,
'venue': _Venue,
'winner': IDL.Text,
});
/// [_Country] defined in Candid
/// ```Candid
/// type Country = record { code: text; is_region: bool; name: text; official_name: text; short_code: text };
/// ```
static final RecordClass _Country = IDL.Record({
'code': IDL.Text,
'is_region': IDL.Bool,
'name': IDL.Text,
'official_name': IDL.Text,
'short_code': IDL.Text,
});
/// [_Competition] defined in Candid
/// ```Candid
/// type Competition = record { code: text; key: text; name: text };
/// ```
static final RecordClass _Competition = IDL.Record({
'code': IDL.Text,
'key': IDL.Text,
'name': IDL.Text,
});
/// [_CPlayer] defined in Candid
/// ```Candid
/// type CPlayer = record { credit: nat; id: nat; name: text; points: nat; position: Position; team: text };
/// ```
static final RecordClass _CPlayer = IDL.Record({
'credit': IDL.Nat,
'id': IDL.Nat,
'name': IDL.Text,
'points': IDL.Nat,
'position': _Position,
'team': IDL.Text,
});
/// [_Association] defined in Candid
/// ```Candid
/// type Association = record { code: text; country: opt text; key: opt text; name: text; parent: opt text };
/// ```
static final RecordClass _Association = IDL.Record({
'code': IDL.Text,
'country': IDL.Opt(
IDL.Text,
),
'key': IDL.Opt(
IDL.Text,
),
'name': IDL.Text,
'parent': IDL.Opt(
IDL.Text,
),
});
static final ServiceClass idl = IDL.Service({
'addMatches': IDL.Func(
[
IDL.Vec(
_CricMatch__1,
)
],
[_QueryResult_8],
[],
),
'addTournament': IDL.Func(
[_Tournament],
[_UpdateResult],
[],
),
'addTournaments': IDL.Func(
[
IDL.Vec(
_Tournament,
)
],
[_UpdateResult],
[],
),
'clearMatches': IDL.Func(
[],
[_QueryResult_8],
[],
),
'clearTournaments': IDL.Func(
[],
[_QueryResult_8],
[],
),
'deleteMatch': IDL.Func(
[IDL.Text],
[_QueryResult_8],
[],
),
'fetchController': IDL.Func(
[],
[
IDL.Vec(
IDL.Principal,
)
],
[],
),
'fetchTournaments': IDL.Func(
[],
[
IDL.Vec(
_Tournament,
)
],
[],
),
'getAllContest': IDL.Func(
[],
[_QueryResult_2],
['query'],
),
'getEntry': IDL.Func(
[_EntryId],
[_QueryResult_7],
['query'],
),
'getLiveContest': IDL.Func(
[],
[_QueryResult_2],
['query'],
),
'getLiveMatch': IDL.Func(
[],
[
IDL.Vec(
_CricMatch,
)
],
['query'],
),
'getMatch': IDL.Func(
[_MatchKey],
[_QueryResult_6],
['query'],
),
'getMatches': IDL.Func(
[],
[_QueryResult_3],
['query'],
),
'getPool': IDL.Func(
[_PoolId__1],
[_QueryResult_5],
['query'],
),
'getTournament': IDL.Func(
[IDL.Text],
[_QueryResult_4],
['query'],
),
'getTournamentMatches': IDL.Func(
[IDL.Text],
[_QueryResult_3],
[],
),
'getUpcomingContest': IDL.Func(
[],
[_QueryResult_2],
['query'],
),
'getUpcomingMatch': IDL.Func(
[],
[
IDL.Vec(
_CricMatch,
)
],
['query'],
),
'queryUser': IDL.Func(
[],
[_QueryResult_1],
['query'],
),
'register': IDL.Func(
[IDL.Text],
[_UpdateResult],
[],
),
'removeTournament': IDL.Func(
[],
[_QueryResult],
[],
),
'updateEntry': IDL.Func(
[_EntryId, _EntryArg],
[_UpdateResult],
[],
),
});
}
/// [Venue] defined in Candid
/// ```Candid
/// record { city: text; country: Country; geolocation: text; key: text; name: text }
/// ```
@immutable
class Venue {
const Venue({
/// [city] defined in Candid: `city: text`
required this.city,
/// [country] defined in Candid: `country: Country`
required this.country,
/// [geolocation] defined in Candid: `geolocation: text`
required this.geolocation,
/// [key] defined in Candid: `key: text`
required this.key,
/// [name] defined in Candid: `name: text`
required this.name,
});
factory Venue.fromJson(Map json) {
return Venue(
city: json['city'],
country: Country.fromJson(json['country']),
geolocation: json['geolocation'],
key: json['key'],
name: json['name'],
);
}
/// [city] defined in Candid: `city: text`
final String city;
/// [country] defined in Candid: `country: Country`
final Country country;
/// [geolocation] defined in Candid: `geolocation: text`
final String geolocation;
/// [key] defined in Candid: `key: text`
final String key;
/// [name] defined in Candid: `name: text`
final String name;
Map<String, dynamic> toJson() {
final city = this.city;
final country = this.country;
final geolocation = this.geolocation;
final key = this.key;
final name = this.name;
return {
'city': city,
'country': country,
'geolocation': geolocation,
'key': key,
'name': name,
};
}
Venue copyWith({
/// [city] defined in Candid: `city: text`
String? city,
/// [country] defined in Candid: `country: Country`
Country? country,
/// [geolocation] defined in Candid: `geolocation: text`
String? geolocation,
/// [key] defined in Candid: `key: text`
String? key,
/// [name] defined in Candid: `name: text`
String? name,
}) {
return Venue(
city: city ?? this.city,
country: country ?? this.country,
geolocation: geolocation ?? this.geolocation,
key: key ?? this.key,
name: name ?? this.name,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Venue &&
(identical(other.city, city) || other.city == city) &&
(identical(other.country, country) || other.country == country) &&
(identical(other.geolocation, geolocation) ||
other.geolocation == geolocation) &&
(identical(other.key, key) || other.key == key) &&
(identical(other.name, name) || other.name == name));
}
@override
int get hashCode =>
Object.hashAll([runtimeType, city, country, geolocation, key, name]);
@override
String toString() {
return toJson().toString();
}
}
/// [UpdateResult] defined in Candid
/// ```Candid
/// variant { err: Error; ok }
/// ```
@immutable
class UpdateResult {
const UpdateResult({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok`
this.ok = false,
});
factory UpdateResult.fromJson(Map json) {
return UpdateResult(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: json.containsKey('ok'),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok`
final bool ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok) 'ok': null,
};
}
UpdateResult copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok`
bool? ok,
}) {
return UpdateResult(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is UpdateResult &&
(identical(other.err, err) || other.err == err) &&
(identical(other.ok, ok) || other.ok == ok));
}
@override
int get hashCode => Object.hashAll([runtimeType, err, ok]);
@override
String toString() {
return toJson().toString();
}
}
/// [TournamentShort] defined in Candid
/// ```Candid
/// record { key: text; name: text; short_name: text }
/// ```
@immutable
class TournamentShort {
const TournamentShort({
/// [key] defined in Candid: `key: text`
required this.key,
/// [name] defined in Candid: `name: text`
required this.name,
/// [shortName] defined in Candid: `short_name: text`
required this.shortName,
});
factory TournamentShort.fromJson(Map json) {
return TournamentShort(
key: json['key'],
name: json['name'],
shortName: json['short_name'],
);
}
/// [key] defined in Candid: `key: text`
final String key;
/// [name] defined in Candid: `name: text`
final String name;
/// [shortName] defined in Candid: `short_name: text`
final String shortName;
Map<String, dynamic> toJson() {
final key = this.key;
final name = this.name;
final shortName = this.shortName;
return {
'key': key,
'name': name,
'short_name': shortName,
};
}
TournamentShort copyWith({
/// [key] defined in Candid: `key: text`
String? key,
/// [name] defined in Candid: `name: text`
String? name,
/// [shortName] defined in Candid: `short_name: text`
String? shortName,
}) {
return TournamentShort(
key: key ?? this.key,
name: name ?? this.name,
shortName: shortName ?? this.shortName,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is TournamentShort &&
(identical(other.key, key) || other.key == key) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.shortName, shortName) ||
other.shortName == shortName));
}
@override
int get hashCode => Object.hashAll([runtimeType, key, name, shortName]);
@override
String toString() {
return toJson().toString();
}
}
/// [Tournament] defined in Candid
/// ```Candid
/// record { association_key: text; competition: Competition; countries: vec Country; formats: vec text; gender: text; is_date_confirmed: bool; is_venue_confirmed: bool; key: text; last_scheduled_match_date: float64; metric_group: text; name: text; point_system: text; short_name: text; sport: text; start_date: nat64 }
/// ```
@immutable
class Tournament {
const Tournament({
/// [associationKey] defined in Candid: `association_key: text`
required this.associationKey,
/// [competition] defined in Candid: `competition: Competition`
required this.competition,
/// [countries] defined in Candid: `countries: vec Country`
required this.countries,
/// [formats] defined in Candid: `formats: vec text`
required this.formats,
/// [gender] defined in Candid: `gender: text`
required this.gender,
/// [isDateConfirmed] defined in Candid: `is_date_confirmed: bool`
required this.isDateConfirmed,
/// [isVenueConfirmed] defined in Candid: `is_venue_confirmed: bool`
required this.isVenueConfirmed,
/// [key] defined in Candid: `key: text`
required this.key,
/// [lastScheduledMatchDate] defined in Candid: `last_scheduled_match_date: float64`
required this.lastScheduledMatchDate,
/// [metricGroup] defined in Candid: `metric_group: text`
required this.metricGroup,
/// [name] defined in Candid: `name: text`
required this.name,
/// [pointSystem] defined in Candid: `point_system: text`
required this.pointSystem,
/// [shortName] defined in Candid: `short_name: text`
required this.shortName,
/// [sport] defined in Candid: `sport: text`
required this.sport,
/// [startDate] defined in Candid: `start_date: nat64`
required this.startDate,
});
factory Tournament.fromJson(Map json) {
return Tournament(
associationKey: json['association_key'],
competition: Competition.fromJson(json['competition']),
countries: (json['countries'] as List).map((e) {
return Country.fromJson(e);
}).toList(),
formats: (json['formats'] as List).cast(),
gender: json['gender'],
isDateConfirmed: json['is_date_confirmed'],
isVenueConfirmed: json['is_venue_confirmed'],
key: json['key'],
lastScheduledMatchDate: json['last_scheduled_match_date'],
metricGroup: json['metric_group'],
name: json['name'],
pointSystem: json['point_system'],
shortName: json['short_name'],
sport: json['sport'],
startDate: json['start_date'] is BigInt
? json['start_date']
: BigInt.from(json['start_date']),
);
}
/// [associationKey] defined in Candid: `association_key: text`
final String associationKey;
/// [competition] defined in Candid: `competition: Competition`
final Competition competition;
/// [countries] defined in Candid: `countries: vec Country`
final List<Country> countries;
/// [formats] defined in Candid: `formats: vec text`
final List<String> formats;
/// [gender] defined in Candid: `gender: text`
final String gender;
/// [isDateConfirmed] defined in Candid: `is_date_confirmed: bool`
final bool isDateConfirmed;
/// [isVenueConfirmed] defined in Candid: `is_venue_confirmed: bool`
final bool isVenueConfirmed;
/// [key] defined in Candid: `key: text`
final String key;
/// [lastScheduledMatchDate] defined in Candid: `last_scheduled_match_date: float64`
final double lastScheduledMatchDate;
/// [metricGroup] defined in Candid: `metric_group: text`
final String metricGroup;
/// [name] defined in Candid: `name: text`
final String name;
/// [pointSystem] defined in Candid: `point_system: text`
final String pointSystem;
/// [shortName] defined in Candid: `short_name: text`
final String shortName;
/// [sport] defined in Candid: `sport: text`
final String sport;
/// [startDate] defined in Candid: `start_date: nat64`
final BigInt startDate;
Map<String, dynamic> toJson() {
final associationKey = this.associationKey;
final competition = this.competition;
final countries = this.countries;
final formats = this.formats;
final gender = this.gender;
final isDateConfirmed = this.isDateConfirmed;
final isVenueConfirmed = this.isVenueConfirmed;
final key = this.key;
final lastScheduledMatchDate = this.lastScheduledMatchDate;
final metricGroup = this.metricGroup;
final name = this.name;
final pointSystem = this.pointSystem;
final shortName = this.shortName;
final sport = this.sport;
final startDate = this.startDate;
return {
'association_key': associationKey,
'competition': competition,
'countries': countries,
'formats': formats,
'gender': gender,
'is_date_confirmed': isDateConfirmed,
'is_venue_confirmed': isVenueConfirmed,
'key': key,
'last_scheduled_match_date': lastScheduledMatchDate,
'metric_group': metricGroup,
'name': name,
'point_system': pointSystem,
'short_name': shortName,
'sport': sport,
'start_date': startDate,
};
}
Tournament copyWith({
/// [associationKey] defined in Candid: `association_key: text`
String? associationKey,
/// [competition] defined in Candid: `competition: Competition`
Competition? competition,
/// [countries] defined in Candid: `countries: vec Country`
List<Country>? countries,
/// [formats] defined in Candid: `formats: vec text`
List<String>? formats,
/// [gender] defined in Candid: `gender: text`
String? gender,
/// [isDateConfirmed] defined in Candid: `is_date_confirmed: bool`
bool? isDateConfirmed,
/// [isVenueConfirmed] defined in Candid: `is_venue_confirmed: bool`
bool? isVenueConfirmed,
/// [key] defined in Candid: `key: text`
String? key,
/// [lastScheduledMatchDate] defined in Candid: `last_scheduled_match_date: float64`
double? lastScheduledMatchDate,
/// [metricGroup] defined in Candid: `metric_group: text`
String? metricGroup,
/// [name] defined in Candid: `name: text`
String? name,
/// [pointSystem] defined in Candid: `point_system: text`
String? pointSystem,
/// [shortName] defined in Candid: `short_name: text`
String? shortName,
/// [sport] defined in Candid: `sport: text`
String? sport,
/// [startDate] defined in Candid: `start_date: nat64`
BigInt? startDate,
}) {
return Tournament(
associationKey: associationKey ?? this.associationKey,
competition: competition ?? this.competition,
countries: countries ?? this.countries,
formats: formats ?? this.formats,
gender: gender ?? this.gender,
isDateConfirmed: isDateConfirmed ?? this.isDateConfirmed,
isVenueConfirmed: isVenueConfirmed ?? this.isVenueConfirmed,
key: key ?? this.key,
lastScheduledMatchDate:
lastScheduledMatchDate ?? this.lastScheduledMatchDate,
metricGroup: metricGroup ?? this.metricGroup,
name: name ?? this.name,
pointSystem: pointSystem ?? this.pointSystem,
shortName: shortName ?? this.shortName,
sport: sport ?? this.sport,
startDate: startDate ?? this.startDate,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Tournament &&
(identical(other.associationKey, associationKey) ||
other.associationKey == associationKey) &&
(identical(other.competition, competition) ||
other.competition == competition) &&
const DeepCollectionEquality().equals(other.countries, countries) &&
const DeepCollectionEquality().equals(other.formats, formats) &&
(identical(other.gender, gender) || other.gender == gender) &&
(identical(other.isDateConfirmed, isDateConfirmed) ||
other.isDateConfirmed == isDateConfirmed) &&
(identical(other.isVenueConfirmed, isVenueConfirmed) ||
other.isVenueConfirmed == isVenueConfirmed) &&
(identical(other.key, key) || other.key == key) &&
(identical(other.lastScheduledMatchDate, lastScheduledMatchDate) ||
other.lastScheduledMatchDate == lastScheduledMatchDate) &&
(identical(other.metricGroup, metricGroup) ||
other.metricGroup == metricGroup) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.pointSystem, pointSystem) ||
other.pointSystem == pointSystem) &&
(identical(other.shortName, shortName) ||
other.shortName == shortName) &&
(identical(other.sport, sport) || other.sport == sport) &&
(identical(other.startDate, startDate) ||
other.startDate == startDate));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
associationKey,
competition,
const DeepCollectionEquality().hash(countries),
const DeepCollectionEquality().hash(formats),
gender,
isDateConfirmed,
isVenueConfirmed,
key,
lastScheduledMatchDate,
metricGroup,
name,
pointSystem,
shortName,
sport,
startDate
]);
@override
String toString() {
return toJson().toString();
}
}
/// [Toss] defined in Candid
/// ```Candid
/// record { called: text; elected: text; winner: text }
/// ```
@immutable
class Toss {
const Toss({
/// [called] defined in Candid: `called: text`
required this.called,
/// [elected] defined in Candid: `elected: text`
required this.elected,
/// [winner] defined in Candid: `winner: text`
required this.winner,
});
factory Toss.fromJson(Map json) {
return Toss(
called: json['called'],
elected: json['elected'],
winner: json['winner'],
);
}
/// [called] defined in Candid: `called: text`
final String called;
/// [elected] defined in Candid: `elected: text`
final String elected;
/// [winner] defined in Candid: `winner: text`
final String winner;
Map<String, dynamic> toJson() {
final called = this.called;
final elected = this.elected;
final winner = this.winner;
return {
'called': called,
'elected': elected,
'winner': winner,
};
}
Toss copyWith({
/// [called] defined in Candid: `called: text`
String? called,
/// [elected] defined in Candid: `elected: text`
String? elected,
/// [winner] defined in Candid: `winner: text`
String? winner,
}) {
return Toss(
called: called ?? this.called,
elected: elected ?? this.elected,
winner: winner ?? this.winner,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Toss &&
(identical(other.called, called) || other.called == called) &&
(identical(other.elected, elected) || other.elected == elected) &&
(identical(other.winner, winner) || other.winner == winner));
}
@override
int get hashCode => Object.hashAll([runtimeType, called, elected, winner]);
@override
String toString() {
return toJson().toString();
}
}
/// [TeamShort] defined in Candid
/// ```Candid
/// record { code: text; country_code: text; key: text; name: text }
/// ```
@immutable
class TeamShort {
const TeamShort({
/// [code] defined in Candid: `code: text`
required this.code,
/// [countryCode] defined in Candid: `country_code: text`
required this.countryCode,
/// [key] defined in Candid: `key: text`
required this.key,
/// [name] defined in Candid: `name: text`
required this.name,
});
factory TeamShort.fromJson(Map json) {
return TeamShort(
code: json['code'],
countryCode: json['country_code'],
key: json['key'],
name: json['name'],
);
}
/// [code] defined in Candid: `code: text`
final String code;
/// [countryCode] defined in Candid: `country_code: text`
final String countryCode;
/// [key] defined in Candid: `key: text`
final String key;
/// [name] defined in Candid: `name: text`
final String name;
Map<String, dynamic> toJson() {
final code = this.code;
final countryCode = this.countryCode;
final key = this.key;
final name = this.name;
return {
'code': code,
'country_code': countryCode,
'key': key,
'name': name,
};
}
TeamShort copyWith({
/// [code] defined in Candid: `code: text`
String? code,
/// [countryCode] defined in Candid: `country_code: text`
String? countryCode,
/// [key] defined in Candid: `key: text`
String? key,
/// [name] defined in Candid: `name: text`
String? name,
}) {
return TeamShort(
code: code ?? this.code,
countryCode: countryCode ?? this.countryCode,
key: key ?? this.key,
name: name ?? this.name,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is TeamShort &&
(identical(other.code, code) || other.code == code) &&
(identical(other.countryCode, countryCode) ||
other.countryCode == countryCode) &&
(identical(other.key, key) || other.key == key) &&
(identical(other.name, name) || other.name == name));
}
@override
int get hashCode =>
Object.hashAll([runtimeType, code, countryCode, key, name]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryUser] defined in Candid
/// ```Candid
/// record { balance: nat; id: nat; lastEntry: Time; liveContestNos: nat; name: text; principal: principal; totalCompletedContest: nat; totalEntries: nat; totalMatchParticipated: nat; totalPoolParticipated: nat; upcomingContestNos: nat }
/// ```
@immutable
class QueryUser {
const QueryUser({
/// [balance] defined in Candid: `balance: nat`
required this.balance,
/// [id] defined in Candid: `id: nat`
required this.id,
/// [lastEntry] defined in Candid: `lastEntry: Time`
required this.lastEntry,
/// [liveContestNos] defined in Candid: `liveContestNos: nat`
required this.liveContestNos,
/// [name] defined in Candid: `name: text`
required this.name,
/// [principal] defined in Candid: `principal: principal`
required this.principal,
/// [totalCompletedContest] defined in Candid: `totalCompletedContest: nat`
required this.totalCompletedContest,
/// [totalEntries] defined in Candid: `totalEntries: nat`
required this.totalEntries,
/// [totalMatchParticipated] defined in Candid: `totalMatchParticipated: nat`
required this.totalMatchParticipated,
/// [totalPoolParticipated] defined in Candid: `totalPoolParticipated: nat`
required this.totalPoolParticipated,
/// [upcomingContestNos] defined in Candid: `upcomingContestNos: nat`
required this.upcomingContestNos,
});
factory QueryUser.fromJson(Map json) {
return QueryUser(
balance: json['balance'] is BigInt
? json['balance']
: BigInt.from(json['balance']),
id: json['id'] is BigInt ? json['id'] : BigInt.from(json['id']),
lastEntry: json['lastEntry'] is BigInt
? json['lastEntry']
: BigInt.from(json['lastEntry']),
liveContestNos: json['liveContestNos'] is BigInt
? json['liveContestNos']
: BigInt.from(json['liveContestNos']),
name: json['name'],
principal: Principal.from(json['principal']),
totalCompletedContest: json['totalCompletedContest'] is BigInt
? json['totalCompletedContest']
: BigInt.from(json['totalCompletedContest']),
totalEntries: json['totalEntries'] is BigInt
? json['totalEntries']
: BigInt.from(json['totalEntries']),
totalMatchParticipated: json['totalMatchParticipated'] is BigInt
? json['totalMatchParticipated']
: BigInt.from(json['totalMatchParticipated']),
totalPoolParticipated: json['totalPoolParticipated'] is BigInt
? json['totalPoolParticipated']
: BigInt.from(json['totalPoolParticipated']),
upcomingContestNos: json['upcomingContestNos'] is BigInt
? json['upcomingContestNos']
: BigInt.from(json['upcomingContestNos']),
);
}
/// [balance] defined in Candid: `balance: nat`
final BigInt balance;
/// [id] defined in Candid: `id: nat`
final BigInt id;
/// [lastEntry] defined in Candid: `lastEntry: Time`
final Time lastEntry;
/// [liveContestNos] defined in Candid: `liveContestNos: nat`
final BigInt liveContestNos;
/// [name] defined in Candid: `name: text`
final String name;
/// [principal] defined in Candid: `principal: principal`
final Principal principal;
/// [totalCompletedContest] defined in Candid: `totalCompletedContest: nat`
final BigInt totalCompletedContest;
/// [totalEntries] defined in Candid: `totalEntries: nat`
final BigInt totalEntries;
/// [totalMatchParticipated] defined in Candid: `totalMatchParticipated: nat`
final BigInt totalMatchParticipated;
/// [totalPoolParticipated] defined in Candid: `totalPoolParticipated: nat`
final BigInt totalPoolParticipated;
/// [upcomingContestNos] defined in Candid: `upcomingContestNos: nat`
final BigInt upcomingContestNos;
Map<String, dynamic> toJson() {
final balance = this.balance;
final id = this.id;
final lastEntry = this.lastEntry;
final liveContestNos = this.liveContestNos;
final name = this.name;
final principal = this.principal;
final totalCompletedContest = this.totalCompletedContest;
final totalEntries = this.totalEntries;
final totalMatchParticipated = this.totalMatchParticipated;
final totalPoolParticipated = this.totalPoolParticipated;
final upcomingContestNos = this.upcomingContestNos;
return {
'balance': balance,
'id': id,
'lastEntry': lastEntry,
'liveContestNos': liveContestNos,
'name': name,
'principal': principal,
'totalCompletedContest': totalCompletedContest,
'totalEntries': totalEntries,
'totalMatchParticipated': totalMatchParticipated,
'totalPoolParticipated': totalPoolParticipated,
'upcomingContestNos': upcomingContestNos,
};
}
QueryUser copyWith({
/// [balance] defined in Candid: `balance: nat`
BigInt? balance,
/// [id] defined in Candid: `id: nat`
BigInt? id,
/// [lastEntry] defined in Candid: `lastEntry: Time`
Time? lastEntry,
/// [liveContestNos] defined in Candid: `liveContestNos: nat`
BigInt? liveContestNos,
/// [name] defined in Candid: `name: text`
String? name,
/// [principal] defined in Candid: `principal: principal`
Principal? principal,
/// [totalCompletedContest] defined in Candid: `totalCompletedContest: nat`
BigInt? totalCompletedContest,
/// [totalEntries] defined in Candid: `totalEntries: nat`
BigInt? totalEntries,
/// [totalMatchParticipated] defined in Candid: `totalMatchParticipated: nat`
BigInt? totalMatchParticipated,
/// [totalPoolParticipated] defined in Candid: `totalPoolParticipated: nat`
BigInt? totalPoolParticipated,
/// [upcomingContestNos] defined in Candid: `upcomingContestNos: nat`
BigInt? upcomingContestNos,
}) {
return QueryUser(
balance: balance ?? this.balance,
id: id ?? this.id,
lastEntry: lastEntry ?? this.lastEntry,
liveContestNos: liveContestNos ?? this.liveContestNos,
name: name ?? this.name,
principal: principal ?? this.principal,
totalCompletedContest:
totalCompletedContest ?? this.totalCompletedContest,
totalEntries: totalEntries ?? this.totalEntries,
totalMatchParticipated:
totalMatchParticipated ?? this.totalMatchParticipated,
totalPoolParticipated:
totalPoolParticipated ?? this.totalPoolParticipated,
upcomingContestNos: upcomingContestNos ?? this.upcomingContestNos,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryUser &&
(identical(other.balance, balance) || other.balance == balance) &&
(identical(other.id, id) || other.id == id) &&
(identical(other.lastEntry, lastEntry) ||
other.lastEntry == lastEntry) &&
(identical(other.liveContestNos, liveContestNos) ||
other.liveContestNos == liveContestNos) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.principal, principal) ||
other.principal == principal) &&
(identical(other.totalCompletedContest, totalCompletedContest) ||
other.totalCompletedContest == totalCompletedContest) &&
(identical(other.totalEntries, totalEntries) ||
other.totalEntries == totalEntries) &&
(identical(other.totalMatchParticipated, totalMatchParticipated) ||
other.totalMatchParticipated == totalMatchParticipated) &&
(identical(other.totalPoolParticipated, totalPoolParticipated) ||
other.totalPoolParticipated == totalPoolParticipated) &&
(identical(other.upcomingContestNos, upcomingContestNos) ||
other.upcomingContestNos == upcomingContestNos));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
balance,
id,
lastEntry,
liveContestNos,
name,
principal,
totalCompletedContest,
totalEntries,
totalMatchParticipated,
totalPoolParticipated,
upcomingContestNos
]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult8] defined in Candid
/// ```Candid
/// variant { err: Error; ok: text }
/// ```
@immutable
class QueryResult8 {
const QueryResult8({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: text`
this.ok,
});
factory QueryResult8.fromJson(Map json) {
return QueryResult8(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: json['ok'],
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: text`
final String? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult8 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: text`
String? ok,
}) {
return QueryResult8(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult8 &&
(identical(other.err, err) || other.err == err) &&
(identical(other.ok, ok) || other.ok == ok));
}
@override
int get hashCode => Object.hashAll([runtimeType, err, ok]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult7] defined in Candid
/// ```Candid
/// variant { err: Error; ok: QueryEntry }
/// ```
@immutable
class QueryResult7 {
const QueryResult7({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: QueryEntry`
this.ok,
});
factory QueryResult7.fromJson(Map json) {
return QueryResult7(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: json['ok'] == null ? null : QueryEntry.fromJson(json['ok']),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: QueryEntry`
final QueryEntry? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult7 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: QueryEntry`
QueryEntry? ok,
}) {
return QueryResult7(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult7 &&
(identical(other.err, err) || other.err == err) &&
(identical(other.ok, ok) || other.ok == ok));
}
@override
int get hashCode => Object.hashAll([runtimeType, err, ok]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult6] defined in Candid
/// ```Candid
/// variant { err: Error; ok: CricMatch__1 }
/// ```
@immutable
class QueryResult6 {
const QueryResult6({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: CricMatch__1`
this.ok,
});
factory QueryResult6.fromJson(Map json) {
return QueryResult6(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: json['ok'] == null ? null : CricMatch1.fromJson(json['ok']),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: CricMatch__1`
final CricMatch1? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult6 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: CricMatch__1`
CricMatch1? ok,
}) {
return QueryResult6(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult6 &&
(identical(other.err, err) || other.err == err) &&
(identical(other.ok, ok) || other.ok == ok));
}
@override
int get hashCode => Object.hashAll([runtimeType, err, ok]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult5] defined in Candid
/// ```Candid
/// variant { err: Error; ok: QueryPool }
/// ```
@immutable
class QueryResult5 {
const QueryResult5({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: QueryPool`
this.ok,
});
factory QueryResult5.fromJson(Map json) {
return QueryResult5(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: json['ok'] == null ? null : QueryPool.fromJson(json['ok']),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: QueryPool`
final QueryPool? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult5 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: QueryPool`
QueryPool? ok,
}) {
return QueryResult5(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult5 &&
(identical(other.err, err) || other.err == err) &&
(identical(other.ok, ok) || other.ok == ok));
}
@override
int get hashCode => Object.hashAll([runtimeType, err, ok]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult4] defined in Candid
/// ```Candid
/// variant { err: Error; ok: Tournament }
/// ```
@immutable
class QueryResult4 {
const QueryResult4({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: Tournament`
this.ok,
});
factory QueryResult4.fromJson(Map json) {
return QueryResult4(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: json['ok'] == null ? null : Tournament.fromJson(json['ok']),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: Tournament`
final Tournament? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult4 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: Tournament`
Tournament? ok,
}) {
return QueryResult4(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult4 &&
(identical(other.err, err) || other.err == err) &&
(identical(other.ok, ok) || other.ok == ok));
}
@override
int get hashCode => Object.hashAll([runtimeType, err, ok]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult3] defined in Candid
/// ```Candid
/// variant { err: Error; ok: vec CricMatch__1 }
/// ```
@immutable
class QueryResult3 {
const QueryResult3({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: vec CricMatch__1`
this.ok,
});
factory QueryResult3.fromJson(Map json) {
return QueryResult3(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: (json['ok'] as List?)?.map((e) {
return CricMatch1.fromJson(e);
}).toList(),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: vec CricMatch__1`
final List<CricMatch1>? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult3 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: vec CricMatch__1`
List<CricMatch1>? ok,
}) {
return QueryResult3(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult3 &&
(identical(other.err, err) || other.err == err) &&
const DeepCollectionEquality().equals(other.ok, ok));
}
@override
int get hashCode => Object.hashAll(
[runtimeType, err, const DeepCollectionEquality().hash(ok)]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult2] defined in Candid
/// ```Candid
/// variant { err: Error; ok: vec QueryEntry }
/// ```
@immutable
class QueryResult2 {
const QueryResult2({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: vec QueryEntry`
this.ok,
});
factory QueryResult2.fromJson(Map json) {
return QueryResult2(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: (json['ok'] as List?)?.map((e) {
return QueryEntry.fromJson(e);
}).toList(),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: vec QueryEntry`
final List<QueryEntry>? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult2 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: vec QueryEntry`
List<QueryEntry>? ok,
}) {
return QueryResult2(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult2 &&
(identical(other.err, err) || other.err == err) &&
const DeepCollectionEquality().equals(other.ok, ok));
}
@override
int get hashCode => Object.hashAll(
[runtimeType, err, const DeepCollectionEquality().hash(ok)]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult1] defined in Candid
/// ```Candid
/// variant { err: Error; ok: QueryUser }
/// ```
@immutable
class QueryResult1 {
const QueryResult1({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: QueryUser`
this.ok,
});
factory QueryResult1.fromJson(Map json) {
return QueryResult1(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: json['ok'] == null ? null : QueryUser.fromJson(json['ok']),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: QueryUser`
final QueryUser? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult1 copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: QueryUser`
QueryUser? ok,
}) {
return QueryResult1(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult1 &&
(identical(other.err, err) || other.err == err) &&
(identical(other.ok, ok) || other.ok == ok));
}
@override
int get hashCode => Object.hashAll([runtimeType, err, ok]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryResult] defined in Candid
/// ```Candid
/// variant { err: Error; ok: vec Tournament }
/// ```
@immutable
class QueryResult {
const QueryResult({
/// [err] defined in Candid: `err: Error`
this.err,
/// [ok] defined in Candid: `ok: vec Tournament`
this.ok,
});
factory QueryResult.fromJson(Map json) {
return QueryResult(
err: json['err'] == null ? null : Error.fromJson(json['err']),
ok: (json['ok'] as List?)?.map((e) {
return Tournament.fromJson(e);
}).toList(),
);
}
/// [err] defined in Candid: `err: Error`
final Error? err;
/// [ok] defined in Candid: `ok: vec Tournament`
final List<Tournament>? ok;
Map<String, dynamic> toJson() {
final err = this.err;
final ok = this.ok;
return {
if (err != null) 'err': err,
if (ok != null) 'ok': ok,
};
}
QueryResult copyWith({
/// [err] defined in Candid: `err: Error`
Error? err,
/// [ok] defined in Candid: `ok: vec Tournament`
List<Tournament>? ok,
}) {
return QueryResult(
err: err ?? this.err,
ok: ok ?? this.ok,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryResult &&
(identical(other.err, err) || other.err == err) &&
const DeepCollectionEquality().equals(other.ok, ok));
}
@override
int get hashCode => Object.hashAll(
[runtimeType, err, const DeepCollectionEquality().hash(ok)]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryPool] defined in Candid
/// ```Candid
/// record { availableSpots: nat; closedAt: opt Time; createdAt: Time; entryAmount: nat; entryPerUser: nat; filledSpots: nat; id: PoolId; matchId: text; spots: nat; status: PoolStatus; title: text }
/// ```
@immutable
class QueryPool {
const QueryPool({
/// [availableSpots] defined in Candid: `availableSpots: nat`
required this.availableSpots,
/// [closedAt] defined in Candid: `closedAt: opt Time`
this.closedAt,
/// [createdAt] defined in Candid: `createdAt: Time`
required this.createdAt,
/// [entryAmount] defined in Candid: `entryAmount: nat`
required this.entryAmount,
/// [entryPerUser] defined in Candid: `entryPerUser: nat`
required this.entryPerUser,
/// [filledSpots] defined in Candid: `filledSpots: nat`
required this.filledSpots,
/// [id] defined in Candid: `id: PoolId`
required this.id,
/// [matchId] defined in Candid: `matchId: text`
required this.matchId,
/// [spots] defined in Candid: `spots: nat`
required this.spots,
/// [status] defined in Candid: `status: PoolStatus`
required this.status,
/// [title] defined in Candid: `title: text`
required this.title,
});
factory QueryPool.fromJson(Map json) {
return QueryPool(
availableSpots: json['availableSpots'] is BigInt
? json['availableSpots']
: BigInt.from(json['availableSpots']),
closedAt: (json['closedAt'] as List).map((e) {
return e == null
? null
: e is BigInt
? e
: BigInt.from(e);
}).firstOrNull,
createdAt: json['createdAt'] is BigInt
? json['createdAt']
: BigInt.from(json['createdAt']),
entryAmount: json['entryAmount'] is BigInt
? json['entryAmount']
: BigInt.from(json['entryAmount']),
entryPerUser: json['entryPerUser'] is BigInt
? json['entryPerUser']
: BigInt.from(json['entryPerUser']),
filledSpots: json['filledSpots'] is BigInt
? json['filledSpots']
: BigInt.from(json['filledSpots']),
id: json['id'],
matchId: json['matchId'],
spots:
json['spots'] is BigInt ? json['spots'] : BigInt.from(json['spots']),
status: PoolStatus.fromJson(json['status']),
title: json['title'],
);
}
/// [availableSpots] defined in Candid: `availableSpots: nat`
final BigInt availableSpots;
/// [closedAt] defined in Candid: `closedAt: opt Time`
final Time? closedAt;
/// [createdAt] defined in Candid: `createdAt: Time`
final Time createdAt;
/// [entryAmount] defined in Candid: `entryAmount: nat`
final BigInt entryAmount;
/// [entryPerUser] defined in Candid: `entryPerUser: nat`
final BigInt entryPerUser;
/// [filledSpots] defined in Candid: `filledSpots: nat`
final BigInt filledSpots;
/// [id] defined in Candid: `id: PoolId`
final PoolId id;
/// [matchId] defined in Candid: `matchId: text`
final String matchId;
/// [spots] defined in Candid: `spots: nat`
final BigInt spots;
/// [status] defined in Candid: `status: PoolStatus`
final PoolStatus status;
/// [title] defined in Candid: `title: text`
final String title;
Map<String, dynamic> toJson() {
final availableSpots = this.availableSpots;
final closedAt = this.closedAt;
final createdAt = this.createdAt;
final entryAmount = this.entryAmount;
final entryPerUser = this.entryPerUser;
final filledSpots = this.filledSpots;
final id = this.id;
final matchId = this.matchId;
final spots = this.spots;
final status = this.status;
final title = this.title;
return {
'availableSpots': availableSpots,
'closedAt': [if (closedAt != null) closedAt],
'createdAt': createdAt,
'entryAmount': entryAmount,
'entryPerUser': entryPerUser,
'filledSpots': filledSpots,
'id': id,
'matchId': matchId,
'spots': spots,
'status': status,
'title': title,
};
}
QueryPool copyWith({
/// [availableSpots] defined in Candid: `availableSpots: nat`
BigInt? availableSpots,
/// [closedAt] defined in Candid: `closedAt: opt Time`
Time? closedAt,
/// [createdAt] defined in Candid: `createdAt: Time`
Time? createdAt,
/// [entryAmount] defined in Candid: `entryAmount: nat`
BigInt? entryAmount,
/// [entryPerUser] defined in Candid: `entryPerUser: nat`
BigInt? entryPerUser,
/// [filledSpots] defined in Candid: `filledSpots: nat`
BigInt? filledSpots,
/// [id] defined in Candid: `id: PoolId`
PoolId? id,
/// [matchId] defined in Candid: `matchId: text`
String? matchId,
/// [spots] defined in Candid: `spots: nat`
BigInt? spots,
/// [status] defined in Candid: `status: PoolStatus`
PoolStatus? status,
/// [title] defined in Candid: `title: text`
String? title,
}) {
return QueryPool(
availableSpots: availableSpots ?? this.availableSpots,
closedAt: closedAt ?? this.closedAt,
createdAt: createdAt ?? this.createdAt,
entryAmount: entryAmount ?? this.entryAmount,
entryPerUser: entryPerUser ?? this.entryPerUser,
filledSpots: filledSpots ?? this.filledSpots,
id: id ?? this.id,
matchId: matchId ?? this.matchId,
spots: spots ?? this.spots,
status: status ?? this.status,
title: title ?? this.title,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryPool &&
(identical(other.availableSpots, availableSpots) ||
other.availableSpots == availableSpots) &&
(identical(other.closedAt, closedAt) ||
other.closedAt == closedAt) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.entryAmount, entryAmount) ||
other.entryAmount == entryAmount) &&
(identical(other.entryPerUser, entryPerUser) ||
other.entryPerUser == entryPerUser) &&
(identical(other.filledSpots, filledSpots) ||
other.filledSpots == filledSpots) &&
(identical(other.id, id) || other.id == id) &&
(identical(other.matchId, matchId) || other.matchId == matchId) &&
(identical(other.spots, spots) || other.spots == spots) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.title, title) || other.title == title));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
availableSpots,
closedAt,
createdAt,
entryAmount,
entryPerUser,
filledSpots,
id,
matchId,
spots,
status,
title
]);
@override
String toString() {
return toJson().toString();
}
}
/// [QueryEntry] defined in Candid
/// ```Candid
/// record { entryAt: Time; id: EntryId__1; matchId: text; point: nat; poolId: PoolId; principal: principal; team: EntryArg; username: text }
/// ```
@immutable
class QueryEntry {
const QueryEntry({
/// [entryAt] defined in Candid: `entryAt: Time`
required this.entryAt,
/// [id] defined in Candid: `id: EntryId__1`
required this.id,
/// [matchId] defined in Candid: `matchId: text`
required this.matchId,
/// [point] defined in Candid: `point: nat`
required this.point,
/// [poolId] defined in Candid: `poolId: PoolId`
required this.poolId,
/// [principal] defined in Candid: `principal: principal`
required this.principal,
/// [team] defined in Candid: `team: EntryArg`
required this.team,
/// [username] defined in Candid: `username: text`
required this.username,
});
factory QueryEntry.fromJson(Map json) {
return QueryEntry(
entryAt: json['entryAt'] is BigInt
? json['entryAt']
: BigInt.from(json['entryAt']),
id: json['id'],
matchId: json['matchId'],
point:
json['point'] is BigInt ? json['point'] : BigInt.from(json['point']),
poolId: json['poolId'],
principal: Principal.from(json['principal']),
team: EntryArg.fromJson(json['team']),
username: json['username'],
);
}
/// [entryAt] defined in Candid: `entryAt: Time`
final Time entryAt;
/// [id] defined in Candid: `id: EntryId__1`
final EntryId1 id;
/// [matchId] defined in Candid: `matchId: text`
final String matchId;
/// [point] defined in Candid: `point: nat`
final BigInt point;
/// [poolId] defined in Candid: `poolId: PoolId`
final PoolId poolId;
/// [principal] defined in Candid: `principal: principal`
final Principal principal;
/// [team] defined in Candid: `team: EntryArg`
final EntryArg team;
/// [username] defined in Candid: `username: text`
final String username;
Map<String, dynamic> toJson() {
final entryAt = this.entryAt;
final id = this.id;
final matchId = this.matchId;
final point = this.point;
final poolId = this.poolId;
final principal = this.principal;
final team = this.team;
final username = this.username;
return {
'entryAt': entryAt,
'id': id,
'matchId': matchId,
'point': point,
'poolId': poolId,
'principal': principal,
'team': team,
'username': username,
};
}
QueryEntry copyWith({
/// [entryAt] defined in Candid: `entryAt: Time`
Time? entryAt,
/// [id] defined in Candid: `id: EntryId__1`
EntryId1? id,
/// [matchId] defined in Candid: `matchId: text`
String? matchId,
/// [point] defined in Candid: `point: nat`
BigInt? point,
/// [poolId] defined in Candid: `poolId: PoolId`
PoolId? poolId,
/// [principal] defined in Candid: `principal: principal`
Principal? principal,
/// [team] defined in Candid: `team: EntryArg`
EntryArg? team,
/// [username] defined in Candid: `username: text`
String? username,
}) {
return QueryEntry(
entryAt: entryAt ?? this.entryAt,
id: id ?? this.id,
matchId: matchId ?? this.matchId,
point: point ?? this.point,
poolId: poolId ?? this.poolId,
principal: principal ?? this.principal,
team: team ?? this.team,
username: username ?? this.username,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is QueryEntry &&
(identical(other.entryAt, entryAt) || other.entryAt == entryAt) &&
(identical(other.id, id) || other.id == id) &&
(identical(other.matchId, matchId) || other.matchId == matchId) &&
(identical(other.point, point) || other.point == point) &&
(identical(other.poolId, poolId) || other.poolId == poolId) &&
(identical(other.principal, principal) ||
other.principal == principal) &&
(identical(other.team, team) || other.team == team) &&
(identical(other.username, username) ||
other.username == username));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
entryAt,
id,
matchId,
point,
poolId,
principal,
team,
username
]);
@override
String toString() {
return toJson().toString();
}
}
/// [Position] defined in Candid
/// ```Candid
/// variant { all; bat; bow; wic }
/// ```
enum Position {
/// [all] defined in Candid: `all`
all('all'),
/// [bat] defined in Candid: `bat`
bat('bat'),
/// [bow] defined in Candid: `bow`
bow('bow'),
/// [wic] defined in Candid: `wic`
wic('wic');
const Position(this.name);
factory Position.fromJson(Map json) {
final key = json.keys.first;
return Position.values.firstWhere((e) => e.name == key);
}
final String name;
bool get isAll => this == Position.all;
bool get isBat => this == Position.bat;
bool get isBow => this == Position.bow;
bool get isWic => this == Position.wic;
Map<String, dynamic> toJson() {
return {name: null};
}
@override
String toString() {
return toJson().toString();
}
}
/// [PoolStatus] defined in Candid
/// ```Candid
/// variant { closed; full; open }
/// ```
enum PoolStatus {
/// [closed] defined in Candid: `closed`
closed('closed'),
/// [full] defined in Candid: `full`
full('full'),
/// [open] defined in Candid: `open`
open('open');
const PoolStatus(this.name);
factory PoolStatus.fromJson(Map json) {
final key = json.keys.first;
return PoolStatus.values.firstWhere((e) => e.name == key);
}
final String name;
bool get isClosed => this == PoolStatus.closed;
bool get isFull => this == PoolStatus.full;
bool get isOpen => this == PoolStatus.open;
Map<String, dynamic> toJson() {
return {name: null};
}
@override
String toString() {
return toJson().toString();
}
}
/// [MatchStatus] defined in Candid
/// ```Candid
/// variant { completed; live; otherReasons: text; upcoming }
/// ```
@immutable
class MatchStatus {
const MatchStatus({
/// [completed] defined in Candid: `completed`
this.completed = false,
/// [live] defined in Candid: `live`
this.live = false,
/// [otherReasons] defined in Candid: `otherReasons: text`
this.otherReasons,
/// [upcoming] defined in Candid: `upcoming`
this.upcoming = false,
});
factory MatchStatus.fromJson(Map json) {
return MatchStatus(
completed: json.containsKey('completed'),
live: json.containsKey('live'),
otherReasons: json['otherReasons'],
upcoming: json.containsKey('upcoming'),
);
}
/// [completed] defined in Candid: `completed`
final bool completed;
/// [live] defined in Candid: `live`
final bool live;
/// [otherReasons] defined in Candid: `otherReasons: text`
final String? otherReasons;
/// [upcoming] defined in Candid: `upcoming`
final bool upcoming;
Map<String, dynamic> toJson() {
final completed = this.completed;
final live = this.live;
final otherReasons = this.otherReasons;
final upcoming = this.upcoming;
return {
if (completed) 'completed': null,
if (live) 'live': null,
if (otherReasons != null) 'otherReasons': otherReasons,
if (upcoming) 'upcoming': null,
};
}
MatchStatus copyWith({
/// [completed] defined in Candid: `completed`
bool? completed,
/// [live] defined in Candid: `live`
bool? live,
/// [otherReasons] defined in Candid: `otherReasons: text`
String? otherReasons,
/// [upcoming] defined in Candid: `upcoming`
bool? upcoming,
}) {
return MatchStatus(
completed: completed ?? this.completed,
live: live ?? this.live,
otherReasons: otherReasons ?? this.otherReasons,
upcoming: upcoming ?? this.upcoming,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is MatchStatus &&
(identical(other.completed, completed) ||
other.completed == completed) &&
(identical(other.live, live) || other.live == live) &&
(identical(other.otherReasons, otherReasons) ||
other.otherReasons == otherReasons) &&
(identical(other.upcoming, upcoming) ||
other.upcoming == upcoming));
}
@override
int get hashCode =>
Object.hashAll([runtimeType, completed, live, otherReasons, upcoming]);
@override
String toString() {
return toJson().toString();
}
}
/// [ErrorUserAlreadyRegistered] defined in Candid
/// ```Candid
/// record { principal; text }
/// ```
@immutable
class ErrorUserAlreadyRegistered {
const ErrorUserAlreadyRegistered(
this.item1,
this.item2,
);
factory ErrorUserAlreadyRegistered.fromJson(List<dynamic> tuple) {
return ErrorUserAlreadyRegistered(
Principal.from(tuple[0]),
tuple[1],
);
}
/// [item1] defined in Candid: `principal`
final Principal item1;
/// [item2] defined in Candid: `text`
final String item2;
List<dynamic> toJson() {
final item1 = this.item1;
final item2 = this.item2;
return [
item1,
item2,
];
}
ErrorUserAlreadyRegistered copyWith({
/// [item1] defined in Candid: `principal`
Principal? item1,
/// [item2] defined in Candid: `text`
String? item2,
}) {
return ErrorUserAlreadyRegistered(
item1 ?? this.item1,
item2 ?? this.item2,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ErrorUserAlreadyRegistered &&
(identical(other.item1, item1) || other.item1 == item1) &&
(identical(other.item2, item2) || other.item2 == item2));
}
@override
int get hashCode => Object.hashAll([runtimeType, item1, item2]);
@override
String toString() {
return toJson().toString();
}
}
/// [Error] defined in Candid
/// ```Candid
/// variant { AnonymousNotAllowed; CantSelectSameTeam: text; EntryNotFound; InsufficientBalance: nat; MatchNotFound; MatchStatusIs: MatchStatus; MaxEntriesInPool: PoolId; NotAController; NotEnoughPlayersInTeam: text; NotYourEntry; PlayerAlreadyExist; PlayerNotFound; PoolNotFound; PoolStatusIs: PoolStatus; TeamAlreadyExists; TeamNotFound: text; TournamentNotFound; UserAlreadyRegistered: record { principal; text }; UserNotFound }
/// ```
@immutable
class Error {
const Error({
/// [anonymousNotAllowed] defined in Candid: `AnonymousNotAllowed`
this.anonymousNotAllowed = false,
/// [cantSelectSameTeam] defined in Candid: `CantSelectSameTeam: text`
this.cantSelectSameTeam,
/// [entryNotFound] defined in Candid: `EntryNotFound`
this.entryNotFound = false,
/// [insufficientBalance] defined in Candid: `InsufficientBalance: nat`
this.insufficientBalance,
/// [matchNotFound] defined in Candid: `MatchNotFound`
this.matchNotFound = false,
/// [matchStatusIs] defined in Candid: `MatchStatusIs: MatchStatus`
this.matchStatusIs,
/// [maxEntriesInPool] defined in Candid: `MaxEntriesInPool: PoolId`
this.maxEntriesInPool,
/// [notAController] defined in Candid: `NotAController`
this.notAController = false,
/// [notEnoughPlayersInTeam] defined in Candid: `NotEnoughPlayersInTeam: text`
this.notEnoughPlayersInTeam,
/// [notYourEntry] defined in Candid: `NotYourEntry`
this.notYourEntry = false,
/// [playerAlreadyExist] defined in Candid: `PlayerAlreadyExist`
this.playerAlreadyExist = false,
/// [playerNotFound] defined in Candid: `PlayerNotFound`
this.playerNotFound = false,
/// [poolNotFound] defined in Candid: `PoolNotFound`
this.poolNotFound = false,
/// [poolStatusIs] defined in Candid: `PoolStatusIs: PoolStatus`
this.poolStatusIs,
/// [teamAlreadyExists] defined in Candid: `TeamAlreadyExists`
this.teamAlreadyExists = false,
/// [teamNotFound] defined in Candid: `TeamNotFound: text`
this.teamNotFound,
/// [tournamentNotFound] defined in Candid: `TournamentNotFound`
this.tournamentNotFound = false,
/// [userAlreadyRegistered] defined in Candid: `UserAlreadyRegistered: record { principal; text }`
this.userAlreadyRegistered,
/// [userNotFound] defined in Candid: `UserNotFound`
this.userNotFound = false,
});
factory Error.fromJson(Map json) {
return Error(
anonymousNotAllowed: json.containsKey('AnonymousNotAllowed'),
cantSelectSameTeam: json['CantSelectSameTeam'],
entryNotFound: json.containsKey('EntryNotFound'),
insufficientBalance: json['InsufficientBalance'] == null
? null
: json['InsufficientBalance'] is BigInt
? json['InsufficientBalance']
: BigInt.from(json['InsufficientBalance']),
matchNotFound: json.containsKey('MatchNotFound'),
matchStatusIs: json['MatchStatusIs'] == null
? null
: MatchStatus.fromJson(json['MatchStatusIs']),
maxEntriesInPool: json['MaxEntriesInPool'],
notAController: json.containsKey('NotAController'),
notEnoughPlayersInTeam: json['NotEnoughPlayersInTeam'],
notYourEntry: json.containsKey('NotYourEntry'),
playerAlreadyExist: json.containsKey('PlayerAlreadyExist'),
playerNotFound: json.containsKey('PlayerNotFound'),
poolNotFound: json.containsKey('PoolNotFound'),
poolStatusIs: json['PoolStatusIs'] == null
? null
: PoolStatus.fromJson(json['PoolStatusIs']),
teamAlreadyExists: json.containsKey('TeamAlreadyExists'),
teamNotFound: json['TeamNotFound'],
tournamentNotFound: json.containsKey('TournamentNotFound'),
userAlreadyRegistered: json['UserAlreadyRegistered'] == null
? null
: ErrorUserAlreadyRegistered(
Principal.from(json['UserAlreadyRegistered'][0]),
json['UserAlreadyRegistered'][1],
),
userNotFound: json.containsKey('UserNotFound'),
);
}
/// [anonymousNotAllowed] defined in Candid: `AnonymousNotAllowed`
final bool anonymousNotAllowed;
/// [cantSelectSameTeam] defined in Candid: `CantSelectSameTeam: text`
final String? cantSelectSameTeam;
/// [entryNotFound] defined in Candid: `EntryNotFound`
final bool entryNotFound;
/// [insufficientBalance] defined in Candid: `InsufficientBalance: nat`
final BigInt? insufficientBalance;
/// [matchNotFound] defined in Candid: `MatchNotFound`
final bool matchNotFound;
/// [matchStatusIs] defined in Candid: `MatchStatusIs: MatchStatus`
final MatchStatus? matchStatusIs;
/// [maxEntriesInPool] defined in Candid: `MaxEntriesInPool: PoolId`
final PoolId? maxEntriesInPool;
/// [notAController] defined in Candid: `NotAController`
final bool notAController;
/// [notEnoughPlayersInTeam] defined in Candid: `NotEnoughPlayersInTeam: text`
final String? notEnoughPlayersInTeam;
/// [notYourEntry] defined in Candid: `NotYourEntry`
final bool notYourEntry;
/// [playerAlreadyExist] defined in Candid: `PlayerAlreadyExist`
final bool playerAlreadyExist;
/// [playerNotFound] defined in Candid: `PlayerNotFound`
final bool playerNotFound;
/// [poolNotFound] defined in Candid: `PoolNotFound`
final bool poolNotFound;
/// [poolStatusIs] defined in Candid: `PoolStatusIs: PoolStatus`
final PoolStatus? poolStatusIs;
/// [teamAlreadyExists] defined in Candid: `TeamAlreadyExists`
final bool teamAlreadyExists;
/// [teamNotFound] defined in Candid: `TeamNotFound: text`
final String? teamNotFound;
/// [tournamentNotFound] defined in Candid: `TournamentNotFound`
final bool tournamentNotFound;
/// [userAlreadyRegistered] defined in Candid: `UserAlreadyRegistered: record { principal; text }`
final ErrorUserAlreadyRegistered? userAlreadyRegistered;
/// [userNotFound] defined in Candid: `UserNotFound`
final bool userNotFound;
Map<String, dynamic> toJson() {
final anonymousNotAllowed = this.anonymousNotAllowed;
final cantSelectSameTeam = this.cantSelectSameTeam;
final entryNotFound = this.entryNotFound;
final insufficientBalance = this.insufficientBalance;
final matchNotFound = this.matchNotFound;
final matchStatusIs = this.matchStatusIs;
final maxEntriesInPool = this.maxEntriesInPool;
final notAController = this.notAController;
final notEnoughPlayersInTeam = this.notEnoughPlayersInTeam;
final notYourEntry = this.notYourEntry;
final playerAlreadyExist = this.playerAlreadyExist;
final playerNotFound = this.playerNotFound;
final poolNotFound = this.poolNotFound;
final poolStatusIs = this.poolStatusIs;
final teamAlreadyExists = this.teamAlreadyExists;
final teamNotFound = this.teamNotFound;
final tournamentNotFound = this.tournamentNotFound;
final userAlreadyRegistered = this.userAlreadyRegistered;
final userNotFound = this.userNotFound;
return {
if (anonymousNotAllowed) 'AnonymousNotAllowed': null,
if (cantSelectSameTeam != null) 'CantSelectSameTeam': cantSelectSameTeam,
if (entryNotFound) 'EntryNotFound': null,
if (insufficientBalance != null)
'InsufficientBalance': insufficientBalance,
if (matchNotFound) 'MatchNotFound': null,
if (matchStatusIs != null) 'MatchStatusIs': matchStatusIs,
if (maxEntriesInPool != null) 'MaxEntriesInPool': maxEntriesInPool,
if (notAController) 'NotAController': null,
if (notEnoughPlayersInTeam != null)
'NotEnoughPlayersInTeam': notEnoughPlayersInTeam,
if (notYourEntry) 'NotYourEntry': null,
if (playerAlreadyExist) 'PlayerAlreadyExist': null,
if (playerNotFound) 'PlayerNotFound': null,
if (poolNotFound) 'PoolNotFound': null,
if (poolStatusIs != null) 'PoolStatusIs': poolStatusIs,
if (teamAlreadyExists) 'TeamAlreadyExists': null,
if (teamNotFound != null) 'TeamNotFound': teamNotFound,
if (tournamentNotFound) 'TournamentNotFound': null,
if (userAlreadyRegistered != null)
'UserAlreadyRegistered': [
userAlreadyRegistered.item1,
userAlreadyRegistered.item2,
],
if (userNotFound) 'UserNotFound': null,
};
}
Error copyWith({
/// [anonymousNotAllowed] defined in Candid: `AnonymousNotAllowed`
bool? anonymousNotAllowed,
/// [cantSelectSameTeam] defined in Candid: `CantSelectSameTeam: text`
String? cantSelectSameTeam,
/// [entryNotFound] defined in Candid: `EntryNotFound`
bool? entryNotFound,
/// [insufficientBalance] defined in Candid: `InsufficientBalance: nat`
BigInt? insufficientBalance,
/// [matchNotFound] defined in Candid: `MatchNotFound`
bool? matchNotFound,
/// [matchStatusIs] defined in Candid: `MatchStatusIs: MatchStatus`
MatchStatus? matchStatusIs,
/// [maxEntriesInPool] defined in Candid: `MaxEntriesInPool: PoolId`
PoolId? maxEntriesInPool,
/// [notAController] defined in Candid: `NotAController`
bool? notAController,
/// [notEnoughPlayersInTeam] defined in Candid: `NotEnoughPlayersInTeam: text`
String? notEnoughPlayersInTeam,
/// [notYourEntry] defined in Candid: `NotYourEntry`
bool? notYourEntry,
/// [playerAlreadyExist] defined in Candid: `PlayerAlreadyExist`
bool? playerAlreadyExist,
/// [playerNotFound] defined in Candid: `PlayerNotFound`
bool? playerNotFound,
/// [poolNotFound] defined in Candid: `PoolNotFound`
bool? poolNotFound,
/// [poolStatusIs] defined in Candid: `PoolStatusIs: PoolStatus`
PoolStatus? poolStatusIs,
/// [teamAlreadyExists] defined in Candid: `TeamAlreadyExists`
bool? teamAlreadyExists,
/// [teamNotFound] defined in Candid: `TeamNotFound: text`
String? teamNotFound,
/// [tournamentNotFound] defined in Candid: `TournamentNotFound`
bool? tournamentNotFound,
/// [userAlreadyRegistered] defined in Candid: `UserAlreadyRegistered: record { principal; text }`
ErrorUserAlreadyRegistered? userAlreadyRegistered,
/// [userNotFound] defined in Candid: `UserNotFound`
bool? userNotFound,
}) {
return Error(
anonymousNotAllowed: anonymousNotAllowed ?? this.anonymousNotAllowed,
cantSelectSameTeam: cantSelectSameTeam ?? this.cantSelectSameTeam,
entryNotFound: entryNotFound ?? this.entryNotFound,
insufficientBalance: insufficientBalance ?? this.insufficientBalance,
matchNotFound: matchNotFound ?? this.matchNotFound,
matchStatusIs: matchStatusIs ?? this.matchStatusIs,
maxEntriesInPool: maxEntriesInPool ?? this.maxEntriesInPool,
notAController: notAController ?? this.notAController,
notEnoughPlayersInTeam:
notEnoughPlayersInTeam ?? this.notEnoughPlayersInTeam,
notYourEntry: notYourEntry ?? this.notYourEntry,
playerAlreadyExist: playerAlreadyExist ?? this.playerAlreadyExist,
playerNotFound: playerNotFound ?? this.playerNotFound,
poolNotFound: poolNotFound ?? this.poolNotFound,
poolStatusIs: poolStatusIs ?? this.poolStatusIs,
teamAlreadyExists: teamAlreadyExists ?? this.teamAlreadyExists,
teamNotFound: teamNotFound ?? this.teamNotFound,
tournamentNotFound: tournamentNotFound ?? this.tournamentNotFound,
userAlreadyRegistered:
userAlreadyRegistered ?? this.userAlreadyRegistered,
userNotFound: userNotFound ?? this.userNotFound,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Error &&
(identical(other.anonymousNotAllowed, anonymousNotAllowed) ||
other.anonymousNotAllowed == anonymousNotAllowed) &&
(identical(other.cantSelectSameTeam, cantSelectSameTeam) ||
other.cantSelectSameTeam == cantSelectSameTeam) &&
(identical(other.entryNotFound, entryNotFound) ||
other.entryNotFound == entryNotFound) &&
(identical(other.insufficientBalance, insufficientBalance) ||
other.insufficientBalance == insufficientBalance) &&
(identical(other.matchNotFound, matchNotFound) ||
other.matchNotFound == matchNotFound) &&
(identical(other.matchStatusIs, matchStatusIs) ||
other.matchStatusIs == matchStatusIs) &&
(identical(other.maxEntriesInPool, maxEntriesInPool) ||
other.maxEntriesInPool == maxEntriesInPool) &&
(identical(other.notAController, notAController) ||
other.notAController == notAController) &&
(identical(other.notEnoughPlayersInTeam, notEnoughPlayersInTeam) ||
other.notEnoughPlayersInTeam == notEnoughPlayersInTeam) &&
(identical(other.notYourEntry, notYourEntry) ||
other.notYourEntry == notYourEntry) &&
(identical(other.playerAlreadyExist, playerAlreadyExist) ||
other.playerAlreadyExist == playerAlreadyExist) &&
(identical(other.playerNotFound, playerNotFound) ||
other.playerNotFound == playerNotFound) &&
(identical(other.poolNotFound, poolNotFound) ||
other.poolNotFound == poolNotFound) &&
(identical(other.poolStatusIs, poolStatusIs) ||
other.poolStatusIs == poolStatusIs) &&
(identical(other.teamAlreadyExists, teamAlreadyExists) ||
other.teamAlreadyExists == teamAlreadyExists) &&
(identical(other.teamNotFound, teamNotFound) ||
other.teamNotFound == teamNotFound) &&
(identical(other.tournamentNotFound, tournamentNotFound) ||
other.tournamentNotFound == tournamentNotFound) &&
(identical(other.userAlreadyRegistered, userAlreadyRegistered) ||
other.userAlreadyRegistered == userAlreadyRegistered) &&
(identical(other.userNotFound, userNotFound) ||
other.userNotFound == userNotFound));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
anonymousNotAllowed,
cantSelectSameTeam,
entryNotFound,
insufficientBalance,
matchNotFound,
matchStatusIs,
maxEntriesInPool,
notAController,
notEnoughPlayersInTeam,
notYourEntry,
playerAlreadyExist,
playerNotFound,
poolNotFound,
poolStatusIs,
teamAlreadyExists,
teamNotFound,
tournamentNotFound,
userAlreadyRegistered,
userNotFound
]);
@override
String toString() {
return toJson().toString();
}
}
/// [EntryArg] defined in Candid
/// ```Candid
/// record { backups: opt vec CPlayer; captian: CPlayer; players: vec CPlayer; viceCaptian: CPlayer }
/// ```
@immutable
class EntryArg {
const EntryArg({
/// [backups] defined in Candid: `backups: opt vec CPlayer`
this.backups,
/// [captian] defined in Candid: `captian: CPlayer`
required this.captian,
/// [players] defined in Candid: `players: vec CPlayer`
required this.players,
/// [viceCaptian] defined in Candid: `viceCaptian: CPlayer`
required this.viceCaptian,
});
factory EntryArg.fromJson(Map json) {
return EntryArg(
backups: (json['backups'] as List).map((e) {
return (e as List?)?.map((e) {
return CPlayer.fromJson(e);
}).toList();
}).firstOrNull,
captian: CPlayer.fromJson(json['captian']),
players: (json['players'] as List).map((e) {
return CPlayer.fromJson(e);
}).toList(),
viceCaptian: CPlayer.fromJson(json['viceCaptian']),
);
}
/// [backups] defined in Candid: `backups: opt vec CPlayer`
final List<CPlayer>? backups;
/// [captian] defined in Candid: `captian: CPlayer`
final CPlayer captian;
/// [players] defined in Candid: `players: vec CPlayer`
final List<CPlayer> players;
/// [viceCaptian] defined in Candid: `viceCaptian: CPlayer`
final CPlayer viceCaptian;
Map<String, dynamic> toJson() {
final backups = this.backups;
final captian = this.captian;
final players = this.players;
final viceCaptian = this.viceCaptian;
return {
'backups': [if (backups != null) backups],
'captian': captian,
'players': players,
'viceCaptian': viceCaptian,
};
}
EntryArg copyWith({
/// [backups] defined in Candid: `backups: opt vec CPlayer`
List<CPlayer>? backups,
/// [captian] defined in Candid: `captian: CPlayer`
CPlayer? captian,
/// [players] defined in Candid: `players: vec CPlayer`
List<CPlayer>? players,
/// [viceCaptian] defined in Candid: `viceCaptian: CPlayer`
CPlayer? viceCaptian,
}) {
return EntryArg(
backups: backups ?? this.backups,
captian: captian ?? this.captian,
players: players ?? this.players,
viceCaptian: viceCaptian ?? this.viceCaptian,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is EntryArg &&
const DeepCollectionEquality().equals(other.backups, backups) &&
(identical(other.captian, captian) || other.captian == captian) &&
const DeepCollectionEquality().equals(other.players, players) &&
(identical(other.viceCaptian, viceCaptian) ||
other.viceCaptian == viceCaptian));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
const DeepCollectionEquality().hash(backups),
captian,
const DeepCollectionEquality().hash(players),
viceCaptian
]);
@override
String toString() {
return toJson().toString();
}
}
/// [CricMatch1Teams] defined in Candid
/// ```Candid
/// record { a: TeamShort; b: TeamShort }
/// ```
@immutable
class CricMatch1Teams {
const CricMatch1Teams({
/// [a] defined in Candid: `a: TeamShort`
required this.a,
/// [b] defined in Candid: `b: TeamShort`
required this.b,
});
factory CricMatch1Teams.fromJson(Map json) {
return CricMatch1Teams(
a: TeamShort.fromJson(json['a']),
b: TeamShort.fromJson(json['b']),
);
}
/// [a] defined in Candid: `a: TeamShort`
final TeamShort a;
/// [b] defined in Candid: `b: TeamShort`
final TeamShort b;
Map<String, dynamic> toJson() {
final a = this.a;
final b = this.b;
return {
'a': a,
'b': b,
};
}
CricMatch1Teams copyWith({
/// [a] defined in Candid: `a: TeamShort`
TeamShort? a,
/// [b] defined in Candid: `b: TeamShort`
TeamShort? b,
}) {
return CricMatch1Teams(
a: a ?? this.a,
b: b ?? this.b,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is CricMatch1Teams &&
(identical(other.a, a) || other.a == a) &&
(identical(other.b, b) || other.b == b));
}
@override
int get hashCode => Object.hashAll([runtimeType, a, b]);
@override
String toString() {
return toJson().toString();
}
}
/// [CricMatchTeams] defined in Candid
/// ```Candid
/// record { a: TeamShort; b: TeamShort }
/// ```
typedef CricMatchTeams = CricMatch1Teams;
/// [CricMatch1] defined in Candid
/// ```Candid
/// record { association: Association; completedAt: opt Time__1; format: text; gender: text; key: text; messages: vec text; metric_group: text; name: text; short_name: text; sport: text; start_at: nat64; start_at_local: opt nat64; status: text; sub_title: text; teams: record { a: TeamShort; b: TeamShort }; toss: opt Toss; tournament: TournamentShort; tournamentKey: text; venue: Venue; winner: text }
/// ```
@immutable
class CricMatch1 {
const CricMatch1({
/// [association] defined in Candid: `association: Association`
required this.association,
/// [completedAt] defined in Candid: `completedAt: opt Time__1`
this.completedAt,
/// [format] defined in Candid: `format: text`
required this.format,
/// [gender] defined in Candid: `gender: text`
required this.gender,
/// [key] defined in Candid: `key: text`
required this.key,
/// [messages] defined in Candid: `messages: vec text`
required this.messages,
/// [metricGroup] defined in Candid: `metric_group: text`
required this.metricGroup,
/// [name] defined in Candid: `name: text`
required this.name,
/// [shortName] defined in Candid: `short_name: text`
required this.shortName,
/// [sport] defined in Candid: `sport: text`
required this.sport,
/// [startAt] defined in Candid: `start_at: nat64`
required this.startAt,
/// [startAtLocal] defined in Candid: `start_at_local: opt nat64`
this.startAtLocal,
/// [status] defined in Candid: `status: text`
required this.status,
/// [subTitle] defined in Candid: `sub_title: text`
required this.subTitle,
/// [teams] defined in Candid: `teams: record { a: TeamShort; b: TeamShort }`
required this.teams,
/// [toss] defined in Candid: `toss: opt Toss`
this.toss,
/// [tournament] defined in Candid: `tournament: TournamentShort`
required this.tournament,
/// [tournamentKey] defined in Candid: `tournamentKey: text`
required this.tournamentKey,
/// [venue] defined in Candid: `venue: Venue`
required this.venue,
/// [winner] defined in Candid: `winner: text`
required this.winner,
});
factory CricMatch1.fromJson(Map json) {
return CricMatch1(
association: Association.fromJson(json['association']),
completedAt: (json['completedAt'] as List).map((e) {
return e == null
? null
: e is BigInt
? e
: BigInt.from(e);
}).firstOrNull,
format: json['format'],
gender: json['gender'],
key: json['key'],
messages: (json['messages'] as List).cast(),
metricGroup: json['metric_group'],
name: json['name'],
shortName: json['short_name'],
sport: json['sport'],
startAt: json['start_at'] is BigInt
? json['start_at']
: BigInt.from(json['start_at']),
startAtLocal: (json['start_at_local'] as List).map((e) {
return e == null
? null
: e is BigInt
? e
: BigInt.from(e);
}).firstOrNull,
status: json['status'],
subTitle: json['sub_title'],
teams: CricMatch1Teams.fromJson(
json['teams'],
),
toss: (json['toss'] as List).map((e) {
return e == null ? null : Toss.fromJson(e);
}).firstOrNull,
tournament: TournamentShort.fromJson(json['tournament']),
tournamentKey: json['tournamentKey'],
venue: Venue.fromJson(json['venue']),
winner: json['winner'],
);
}
/// [association] defined in Candid: `association: Association`
final Association association;
/// [completedAt] defined in Candid: `completedAt: opt Time__1`
final Time1? completedAt;
/// [format] defined in Candid: `format: text`
final String format;
/// [gender] defined in Candid: `gender: text`
final String gender;
/// [key] defined in Candid: `key: text`
final String key;
/// [messages] defined in Candid: `messages: vec text`
final List<String> messages;
/// [metricGroup] defined in Candid: `metric_group: text`
final String metricGroup;
/// [name] defined in Candid: `name: text`
final String name;
/// [shortName] defined in Candid: `short_name: text`
final String shortName;
/// [sport] defined in Candid: `sport: text`
final String sport;
/// [startAt] defined in Candid: `start_at: nat64`
final BigInt startAt;
/// [startAtLocal] defined in Candid: `start_at_local: opt nat64`
final BigInt? startAtLocal;
/// [status] defined in Candid: `status: text`
final String status;
/// [subTitle] defined in Candid: `sub_title: text`
final String subTitle;
/// [teams] defined in Candid: `teams: record { a: TeamShort; b: TeamShort }`
final CricMatch1Teams teams;
/// [toss] defined in Candid: `toss: opt Toss`
final Toss? toss;
/// [tournament] defined in Candid: `tournament: TournamentShort`
final TournamentShort tournament;
/// [tournamentKey] defined in Candid: `tournamentKey: text`
final String tournamentKey;
/// [venue] defined in Candid: `venue: Venue`
final Venue venue;
/// [winner] defined in Candid: `winner: text`
final String winner;
Map<String, dynamic> toJson() {
final association = this.association;
final completedAt = this.completedAt;
final format = this.format;
final gender = this.gender;
final key = this.key;
final messages = this.messages;
final metricGroup = this.metricGroup;
final name = this.name;
final shortName = this.shortName;
final sport = this.sport;
final startAt = this.startAt;
final startAtLocal = this.startAtLocal;
final status = this.status;
final subTitle = this.subTitle;
final teams = this.teams;
final toss = this.toss;
final tournament = this.tournament;
final tournamentKey = this.tournamentKey;
final venue = this.venue;
final winner = this.winner;
return {
'association': association,
'completedAt': [if (completedAt != null) completedAt],
'format': format,
'gender': gender,
'key': key,
'messages': messages,
'metric_group': metricGroup,
'name': name,
'short_name': shortName,
'sport': sport,
'start_at': startAt,
'start_at_local': [if (startAtLocal != null) startAtLocal],
'status': status,
'sub_title': subTitle,
'teams': teams,
'toss': [if (toss != null) toss],
'tournament': tournament,
'tournamentKey': tournamentKey,
'venue': venue,
'winner': winner,
};
}
CricMatch1 copyWith({
/// [association] defined in Candid: `association: Association`
Association? association,
/// [completedAt] defined in Candid: `completedAt: opt Time__1`
Time1? completedAt,
/// [format] defined in Candid: `format: text`
String? format,
/// [gender] defined in Candid: `gender: text`
String? gender,
/// [key] defined in Candid: `key: text`
String? key,
/// [messages] defined in Candid: `messages: vec text`
List<String>? messages,
/// [metricGroup] defined in Candid: `metric_group: text`
String? metricGroup,
/// [name] defined in Candid: `name: text`
String? name,
/// [shortName] defined in Candid: `short_name: text`
String? shortName,
/// [sport] defined in Candid: `sport: text`
String? sport,
/// [startAt] defined in Candid: `start_at: nat64`
BigInt? startAt,
/// [startAtLocal] defined in Candid: `start_at_local: opt nat64`
BigInt? startAtLocal,
/// [status] defined in Candid: `status: text`
String? status,
/// [subTitle] defined in Candid: `sub_title: text`
String? subTitle,
/// [teams] defined in Candid: `teams: record { a: TeamShort; b: TeamShort }`
CricMatch1Teams? teams,
/// [toss] defined in Candid: `toss: opt Toss`
Toss? toss,
/// [tournament] defined in Candid: `tournament: TournamentShort`
TournamentShort? tournament,
/// [tournamentKey] defined in Candid: `tournamentKey: text`
String? tournamentKey,
/// [venue] defined in Candid: `venue: Venue`
Venue? venue,
/// [winner] defined in Candid: `winner: text`
String? winner,
}) {
return CricMatch1(
association: association ?? this.association,
completedAt: completedAt ?? this.completedAt,
format: format ?? this.format,
gender: gender ?? this.gender,
key: key ?? this.key,
messages: messages ?? this.messages,
metricGroup: metricGroup ?? this.metricGroup,
name: name ?? this.name,
shortName: shortName ?? this.shortName,
sport: sport ?? this.sport,
startAt: startAt ?? this.startAt,
startAtLocal: startAtLocal ?? this.startAtLocal,
status: status ?? this.status,
subTitle: subTitle ?? this.subTitle,
teams: teams ?? this.teams,
toss: toss ?? this.toss,
tournament: tournament ?? this.tournament,
tournamentKey: tournamentKey ?? this.tournamentKey,
venue: venue ?? this.venue,
winner: winner ?? this.winner,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is CricMatch1 &&
(identical(other.association, association) ||
other.association == association) &&
(identical(other.completedAt, completedAt) ||
other.completedAt == completedAt) &&
(identical(other.format, format) || other.format == format) &&
(identical(other.gender, gender) || other.gender == gender) &&
(identical(other.key, key) || other.key == key) &&
const DeepCollectionEquality().equals(other.messages, messages) &&
(identical(other.metricGroup, metricGroup) ||
other.metricGroup == metricGroup) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.shortName, shortName) ||
other.shortName == shortName) &&
(identical(other.sport, sport) || other.sport == sport) &&
(identical(other.startAt, startAt) || other.startAt == startAt) &&
(identical(other.startAtLocal, startAtLocal) ||
other.startAtLocal == startAtLocal) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.subTitle, subTitle) ||
other.subTitle == subTitle) &&
(identical(other.teams, teams) || other.teams == teams) &&
(identical(other.toss, toss) || other.toss == toss) &&
(identical(other.tournament, tournament) ||
other.tournament == tournament) &&
(identical(other.tournamentKey, tournamentKey) ||
other.tournamentKey == tournamentKey) &&
(identical(other.venue, venue) || other.venue == venue) &&
(identical(other.winner, winner) || other.winner == winner));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
association,
completedAt,
format,
gender,
key,
const DeepCollectionEquality().hash(messages),
metricGroup,
name,
shortName,
sport,
startAt,
startAtLocal,
status,
subTitle,
teams,
toss,
tournament,
tournamentKey,
venue,
winner
]);
@override
String toString() {
return toJson().toString();
}
}
/// [CricMatch] defined in Candid
/// ```Candid
/// record { association: Association; completedAt: opt Time__1; format: text; gender: text; key: text; messages: vec text; metric_group: text; name: text; short_name: text; sport: text; start_at: nat64; start_at_local: opt nat64; status: text; sub_title: text; teams: record { a: TeamShort; b: TeamShort }; toss: opt Toss; tournament: TournamentShort; tournamentKey: text; venue: Venue; winner: text }
/// ```
typedef CricMatch = CricMatch1;
/// [Country] defined in Candid
/// ```Candid
/// record { code: text; is_region: bool; name: text; official_name: text; short_code: text }
/// ```
@immutable
class Country {
const Country({
/// [code] defined in Candid: `code: text`
required this.code,
/// [isRegion] defined in Candid: `is_region: bool`
required this.isRegion,
/// [name] defined in Candid: `name: text`
required this.name,
/// [officialName] defined in Candid: `official_name: text`
required this.officialName,
/// [shortCode] defined in Candid: `short_code: text`
required this.shortCode,
});
factory Country.fromJson(Map json) {
return Country(
code: json['code'],
isRegion: json['is_region'],
name: json['name'],
officialName: json['official_name'],
shortCode: json['short_code'],
);
}
/// [code] defined in Candid: `code: text`
final String code;
/// [isRegion] defined in Candid: `is_region: bool`
final bool isRegion;
/// [name] defined in Candid: `name: text`
final String name;
/// [officialName] defined in Candid: `official_name: text`
final String officialName;
/// [shortCode] defined in Candid: `short_code: text`
final String shortCode;
Map<String, dynamic> toJson() {
final code = this.code;
final isRegion = this.isRegion;
final name = this.name;
final officialName = this.officialName;
final shortCode = this.shortCode;
return {
'code': code,
'is_region': isRegion,
'name': name,
'official_name': officialName,
'short_code': shortCode,
};
}
Country copyWith({
/// [code] defined in Candid: `code: text`
String? code,
/// [isRegion] defined in Candid: `is_region: bool`
bool? isRegion,
/// [name] defined in Candid: `name: text`
String? name,
/// [officialName] defined in Candid: `official_name: text`
String? officialName,
/// [shortCode] defined in Candid: `short_code: text`
String? shortCode,
}) {
return Country(
code: code ?? this.code,
isRegion: isRegion ?? this.isRegion,
name: name ?? this.name,
officialName: officialName ?? this.officialName,
shortCode: shortCode ?? this.shortCode,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Country &&
(identical(other.code, code) || other.code == code) &&
(identical(other.isRegion, isRegion) ||
other.isRegion == isRegion) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.officialName, officialName) ||
other.officialName == officialName) &&
(identical(other.shortCode, shortCode) ||
other.shortCode == shortCode));
}
@override
int get hashCode => Object.hashAll(
[runtimeType, code, isRegion, name, officialName, shortCode]);
@override
String toString() {
return toJson().toString();
}
}
/// [Competition] defined in Candid
/// ```Candid
/// record { code: text; key: text; name: text }
/// ```
@immutable
class Competition {
const Competition({
/// [code] defined in Candid: `code: text`
required this.code,
/// [key] defined in Candid: `key: text`
required this.key,
/// [name] defined in Candid: `name: text`
required this.name,
});
factory Competition.fromJson(Map json) {
return Competition(
code: json['code'],
key: json['key'],
name: json['name'],
);
}
/// [code] defined in Candid: `code: text`
final String code;
/// [key] defined in Candid: `key: text`
final String key;
/// [name] defined in Candid: `name: text`
final String name;
Map<String, dynamic> toJson() {
final code = this.code;
final key = this.key;
final name = this.name;
return {
'code': code,
'key': key,
'name': name,
};
}
Competition copyWith({
/// [code] defined in Candid: `code: text`
String? code,
/// [key] defined in Candid: `key: text`
String? key,
/// [name] defined in Candid: `name: text`
String? name,
}) {
return Competition(
code: code ?? this.code,
key: key ?? this.key,
name: name ?? this.name,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Competition &&
(identical(other.code, code) || other.code == code) &&
(identical(other.key, key) || other.key == key) &&
(identical(other.name, name) || other.name == name));
}
@override
int get hashCode => Object.hashAll([runtimeType, code, key, name]);
@override
String toString() {
return toJson().toString();
}
}
/// [CPlayer] defined in Candid
/// ```Candid
/// record { credit: nat; id: nat; name: text; points: nat; position: Position; team: text }
/// ```
@immutable
class CPlayer {
const CPlayer({
/// [credit] defined in Candid: `credit: nat`
required this.credit,
/// [id] defined in Candid: `id: nat`
required this.id,
/// [name] defined in Candid: `name: text`
required this.name,
/// [points] defined in Candid: `points: nat`
required this.points,
/// [position] defined in Candid: `position: Position`
required this.position,
/// [team] defined in Candid: `team: text`
required this.team,
});
factory CPlayer.fromJson(Map json) {
return CPlayer(
credit: json['credit'] is BigInt
? json['credit']
: BigInt.from(json['credit']),
id: json['id'] is BigInt ? json['id'] : BigInt.from(json['id']),
name: json['name'],
points: json['points'] is BigInt
? json['points']
: BigInt.from(json['points']),
position: Position.fromJson(json['position']),
team: json['team'],
);
}
/// [credit] defined in Candid: `credit: nat`
final BigInt credit;
/// [id] defined in Candid: `id: nat`
final BigInt id;
/// [name] defined in Candid: `name: text`
final String name;
/// [points] defined in Candid: `points: nat`
final BigInt points;
/// [position] defined in Candid: `position: Position`
final Position position;
/// [team] defined in Candid: `team: text`
final String team;
Map<String, dynamic> toJson() {
final credit = this.credit;
final id = this.id;
final name = this.name;
final points = this.points;
final position = this.position;
final team = this.team;
return {
'credit': credit,
'id': id,
'name': name,
'points': points,
'position': position,
'team': team,
};
}
CPlayer copyWith({
/// [credit] defined in Candid: `credit: nat`
BigInt? credit,
/// [id] defined in Candid: `id: nat`
BigInt? id,
/// [name] defined in Candid: `name: text`
String? name,
/// [points] defined in Candid: `points: nat`
BigInt? points,
/// [position] defined in Candid: `position: Position`
Position? position,
/// [team] defined in Candid: `team: text`
String? team,
}) {
return CPlayer(
credit: credit ?? this.credit,
id: id ?? this.id,
name: name ?? this.name,
points: points ?? this.points,
position: position ?? this.position,
team: team ?? this.team,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is CPlayer &&
(identical(other.credit, credit) || other.credit == credit) &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.points, points) || other.points == points) &&
(identical(other.position, position) ||
other.position == position) &&
(identical(other.team, team) || other.team == team));
}
@override
int get hashCode =>
Object.hashAll([runtimeType, credit, id, name, points, position, team]);
@override
String toString() {
return toJson().toString();
}
}
/// [Association] defined in Candid
/// ```Candid
/// record { code: text; country: opt text; key: opt text; name: text; parent: opt text }
/// ```
@immutable
class Association {
const Association({
/// [code] defined in Candid: `code: text`
required this.code,
/// [country] defined in Candid: `country: opt text`
this.country,
/// [key] defined in Candid: `key: opt text`
this.key,
/// [name] defined in Candid: `name: text`
required this.name,
/// [parent] defined in Candid: `parent: opt text`
this.parent,
});
factory Association.fromJson(Map json) {
return Association(
code: json['code'],
country: (json['country'] as List).map((e) {
return e;
}).firstOrNull,
key: (json['key'] as List).map((e) {
return e;
}).firstOrNull,
name: json['name'],
parent: (json['parent'] as List).map((e) {
return e;
}).firstOrNull,
);
}
/// [code] defined in Candid: `code: text`
final String code;
/// [country] defined in Candid: `country: opt text`
final String? country;
/// [key] defined in Candid: `key: opt text`
final String? key;
/// [name] defined in Candid: `name: text`
final String name;
/// [parent] defined in Candid: `parent: opt text`
final String? parent;
Map<String, dynamic> toJson() {
final code = this.code;
final country = this.country;
final key = this.key;
final name = this.name;
final parent = this.parent;
return {
'code': code,
'country': [if (country != null) country],
'key': [if (key != null) key],
'name': name,
'parent': [if (parent != null) parent],
};
}
Association copyWith({
/// [code] defined in Candid: `code: text`
String? code,
/// [country] defined in Candid: `country: opt text`
String? country,
/// [key] defined in Candid: `key: opt text`
String? key,
/// [name] defined in Candid: `name: text`
String? name,
/// [parent] defined in Candid: `parent: opt text`
String? parent,
}) {
return Association(
code: code ?? this.code,
country: country ?? this.country,
key: key ?? this.key,
name: name ?? this.name,
parent: parent ?? this.parent,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Association &&
(identical(other.code, code) || other.code == code) &&
(identical(other.country, country) || other.country == country) &&
(identical(other.key, key) || other.key == key) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.parent, parent) || other.parent == parent));
}
@override
int get hashCode =>
Object.hashAll([runtimeType, code, country, key, name, parent]);
@override
String toString() {
return toJson().toString();
}
}
/// [UpdateEntryArg] defined in Candid
/// ```Candid
/// (EntryId, EntryArg)
/// ```
@immutable
class UpdateEntryArg {
const UpdateEntryArg(
this.item1,
this.item2,
);
factory UpdateEntryArg.fromJson(List<dynamic> tuple) {
return UpdateEntryArg(
tuple[0],
EntryArg.fromJson(tuple[1]),
);
}
/// [item1] defined in Candid: `EntryId`
final EntryId item1;
/// [item2] defined in Candid: `EntryArg`
final EntryArg item2;
List<dynamic> toJson() {
final item1 = this.item1;
final item2 = this.item2;
return [
item1,
item2,
];
}
UpdateEntryArg copyWith({
/// [item1] defined in Candid: `EntryId`
EntryId? item1,
/// [item2] defined in Candid: `EntryArg`
EntryArg? item2,
}) {
return UpdateEntryArg(
item1 ?? this.item1,
item2 ?? this.item2,
);
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is UpdateEntryArg &&
(identical(other.item1, item1) || other.item1 == item1) &&
(identical(other.item2, item2) || other.item2 == item2));
}
@override
int get hashCode => Object.hashAll([runtimeType, item1, item2]);
@override
String toString() {
return toJson().toString();
}
}
/// [Time1] defined in Candid
/// ```Candid
/// type Time__1 = int;
/// ```
typedef Time1 = BigInt;
/// [Time] defined in Candid
/// ```Candid
/// type Time = int;
/// ```
typedef Time = BigInt;
/// [PoolId1] defined in Candid
/// ```Candid
/// type PoolId__1 = text;
/// ```
typedef PoolId1 = String;
/// [PoolId] defined in Candid
/// ```Candid
/// type PoolId = text;
/// ```
typedef PoolId = String;
/// [MatchKey] defined in Candid
/// ```Candid
/// type MatchKey = text;
/// ```
typedef MatchKey = String;
/// [EntryId1] defined in Candid
/// ```Candid
/// type EntryId__1 = text;
/// ```
typedef EntryId1 = String;
/// [EntryId] defined in Candid
/// ```Candid
/// type EntryId = text;
/// ```
typedef EntryId = String;
You don't need to worry about the large amount of generated code, it will be shaken and optimized during building
u mean i should not pass json object from api to CricMatch.fromJson(data[match]) directly ?
If you did that, you need to modify it to directly use the constructor of the object.
Has this issue been resolved? @s1dc0des
Please try this version:agent_dart: ^1.0.0-dev.15
ffi bridge errors. tried flutter clean and pub cache clean its not happening with another project which has same version.
return _platform.executeNormal(FlutterRustBridgeTask(
^
: Context: Found this candidate, but the arguments don't match.
basic.dart:179
const FlutterRustBridgeTask({
^^^^^^^^^^^^^^^^^^^^^
: Error: Required named parameter 'parseErrorData' must be provided.
ffi_bridge.dart:894
return _platform.executeNormal(FlutterRustBridgeTask(
^
: Context: Found this candidate, but the arguments don't match.
basic.dart:179
const FlutterRustBridgeTask({
^^^^^^^^^^^^^^^^^^^^^
: Error: Required named parameter 'parseErrorData' must be provided.
ffi_bridge.dart:912
return _platform.executeNormal(FlutterRustBridgeTask(
^
: Context: Found this candidate, but the arguments don't match.
basic.dart:179
const FlutterRustBridgeTask({
^^^^^^^^^^^^^^^^^^^^^
: Error: Required named parameter 'parseErrorData' must be provided.
ffi_bridge.dart:930
return _platform.executeNormal(FlutterRustBridgeTask(
^
: Context: Found this candidate, but the arguments don't match.
basic.dart:179
const FlutterRustBridgeTask({
^^^^^^^^^^^^^^^^^^^^^
: Error: Required named parameter 'parseErrorData' must be provided.
ffi_bridge.dart:948
return _platform.executeNormal(FlutterRustBridgeTask(
^
: Context: Found this candidate, but the arguments don't match.
basic.dart:179
const FlutterRustBridgeTask({
^^^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/opt/homebrew/Caskroom/flutter/3.13.4/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Exception: Gradle task assembleDebug failed with exit code 1
Exited
created a new proj. added agent dart : dev. flutter run. works.
added few more files and functions it throws ffi errors. can u try running it.
created a new proj. added agent dart : dev.
flutter run. works.
added few more files and functions it throws ffi errors.
can u try running it.
Can you use 1.0.0-dev.15 for you project? And please run flutter clean before flutter run
same errors. changes pushed.
dependencies:
agent_dart: ^1.0.0-dev.15
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
get_it: ^7.6.0
# Please include them
archive: 3.3.7
flutter_rust_bridge: 1.77.1
.did
. But when I used the .did
provided by icscan, it operated as expected.The reason for adding the two new deps above is that they do not follow semantic versioning, causing pub get
to return a breaking change version.
After modifying the above content, you should be able to get it working properly. Look forward to hearing good news from you.
boom boom works now. also can u delete all the messages in this issue ?
for a optional type in candid.
the generated dart code is
which throws error "type 'Null' is not a subtype of type 'List' in type cast"
it can be