mirror of
https://github.com/flutter/samples.git
synced 2026-04-03 10:13:39 +00:00
Adds a template / sample for games built in Flutter, with all the bells and whistles, like ads, in-app purchases, audio, main menu, settings, and so on. Co-authored-by: Parker Lougheed Co-authored-by: Shams Zakhour
42 lines
1.4 KiB
Dart
42 lines
1.4 KiB
Dart
// Copyright 2022, the Flutter project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
/// Represents the state of an in-app purchase of ad removal such as
|
|
/// [AdRemovalPurchase.notStarted()] or [AdRemovalPurchase.active()].
|
|
class AdRemovalPurchase {
|
|
/// The representation of this product on the stores.
|
|
static const productId = 'remove_ads';
|
|
|
|
/// This is `true` if the `remove_ad` product has been purchased and verified.
|
|
/// Do not show ads if so.
|
|
final bool active;
|
|
|
|
/// This is `true` when the purchase is pending.
|
|
final bool pending;
|
|
|
|
/// If there was an error with the purchase, this field will contain
|
|
/// that error.
|
|
final Object? error;
|
|
|
|
const AdRemovalPurchase.active() : this._(true, false, null);
|
|
|
|
const AdRemovalPurchase.error(Object error) : this._(false, false, error);
|
|
|
|
const AdRemovalPurchase.notStarted() : this._(false, false, null);
|
|
|
|
const AdRemovalPurchase.pending() : this._(false, true, null);
|
|
|
|
const AdRemovalPurchase._(this.active, this.pending, this.error);
|
|
|
|
@override
|
|
int get hashCode => Object.hash(active, pending, error);
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
other is AdRemovalPurchase &&
|
|
other.active == active &&
|
|
other.pending == pending &&
|
|
other.error == error;
|
|
}
|