Skip to content

Commit

Permalink
fix: add condition for verify
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyokone committed Oct 11, 2022
1 parent 107d662 commit 01c5841
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ part of firebase_database;
/// Represents a query over the data at a particular location.
class Query {
Query._(this._queryDelegate, [QueryModifiers? modifiers])
: _modifiers = modifiers ?? QueryModifiers([]);
: _modifiers = modifiers ?? QueryModifiers([]) {
QueryPlatform.verify(_queryDelegate);
}

final QueryPlatform _queryDelegate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ abstract class QueryPlatform extends PlatformInterface {

static final Object _token = Object();

/// Throws an [AssertionError] if [instance] does not extend
/// [QueryPlatform].
///
/// This is used by the app-facing [Query] to ensure that
/// the object in which it's going to delegate calls has been
/// constructed properly.
static void verify(QueryPlatform instance) {
PlatformInterface.verify(instance, _token);
}

/// Create a [QueryPlatform] instance
QueryPlatform({
required this.database,
Expand Down

0 comments on commit 01c5841

Please sign in to comment.