Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range error when performing any action - max must be in range 0 < max ≤ 2^32, was 0 #152

Closed
akshatmalik opened this issue Feb 17, 2025 · 3 comments

Comments

@akshatmalik
Copy link

Hi, so when I intialize or do any action, I get the following error.

I think the error is getting the nextInt for stamp.

  // Initialize Adapty
  Future<void> initialize() async {
    AdaptyLogger.logLevel = AdaptyLogLevel.verbose;
    print(AdaptyLogger.stamp);
    Adapty().setLogLevel(AdaptyLogLevel.verbose);
    try {
      print('Activating Adapty');
       await Adapty().activate(
          configuration: AdaptyConfiguration(
        apiKey: '<key>',
      ));
      print('Adapty activated');
      await _configurePlatform();
      print('Platform configured');
      await _syncCurrentStatus();
      print('Current status synced');
    } catch (e) {
      debugPrint('Error initializing subscription service: $e');
      rethrow;
    }
  }
---------------
  static String get stamp {
    var result = '';
    final random = _random.nextInt(1 << 32);
    for (var i = 0; i < 4; i++) {
      final index = (random >> (i * 8)) % _stampChars.length;
      result += _stampChars[index];
    }
    return result;
  }
DartError: RangeError: max must be in range 0 < max ≤ 2^32, was 0
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:3                   throw_
errors.dart:288
dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39                             nextInt
profile.dart:110
packages/adapty_flutter/src/adapty_logger.dart 19:28                                          get stamp
adapty_logger.dart:19
packages/rapid_prototyping/src/presentation/providers/aptly_subscription_service.dart 120:24  <fn>
aptly_subscription_service.dart:120
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 610:19                           <fn>
async_patch.dart:610
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 634:23                           <fn>
async_patch.dart:634
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 532:3                            _asyncStartSync
async_patch.dart:532
packages/rapid_prototyping/src/presentation/providers/aptly_subscription_service.dart 118:16  initialize
aptly_subscription_service.dart:118
packages/rapid_prototyping/main.dart 159:14                                                   initState
main.dart:159
packages/flutter/src/widgets/framework.dart 5762:55                                           [_firstBuild]
framework.dart:5762
packages/flutter/src/widgets/framework.dart 5607:5                                            mount
framework.dart:5607
packages/flutter/src/widgets/framework.dart 4480:15                                           inflateWidget
framework.dart:4480
packages/flutter/src/widgets/framework.dart 3963:18                                           updateChild
framework.dart:3963
packages/flutter/src/widgets/framework.dart 5656:16                                           performRebuild
framework.dart:5656
packages/flutter/src/widgets/framework.dart 5347:7                                            rebuild
framework.dart:5347
packages/flutter/src/widgets/framework.dart 5613:5                                            [_firstBuild]
framework.dart:5613
packages/flutter/src/widgets/framework.dart 5607:5                                            mount
framework.dart:5607
packages/flutter_riverpod/src/framework.dart 315:11                                           mount
@x401om
Copy link
Collaborator

x401om commented Feb 18, 2025

Hi @akshatmalik, thank you for the issue! Which platform is affected, iOS or Android?

@akshatmalik
Copy link
Author

It was on iOS.

@x401om
Copy link
Collaborator

x401om commented Feb 19, 2025

Hello! This issue should be fixed in 3.3.2

@x401om x401om closed this as completed Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants