Skip to content

Failed assertion: line 31 pos 16: 'dotsCount != null && dotsCount > 0': is not true #14

@NTMS2017

Description

@NTMS2017

Hi,

I am getting error as:
'package:dots_indicator/src/dots_indicator.dart': Failed assertion: line 31 pos 16: 'dotsCount != null && dotsCount > 0': is not true.

In init state part I am getting a data from remote server. Once the data verify I set the loadIndicator true so I can show the page. in area that data verify before setting the page loadIndicator to true in setState I set the pageLength. pageLength is integer and it totals of list of the data that I get from database. Everything works. Even I set the dotsCount = pageLength;

Any idea why I am keep getting this error?

My code:

return Scaffold(
    body: new Form(
      key: _formKey,
      child: Stack(
        children: [
          Column(
            children: [
              // IMAGE AREA TOP
              Container(
                height: 230.0,
                width: MediaQuery.of(context).size.width - 50.0,
                child: PageView.builder(
                  scrollDirection: Axis.horizontal,
                  controller: _pageController,
                  onPageChanged: ((_page) {
                    setState(() {
                      int _currentValue = int.parse('$_page');
                      currentIndexPage = _currentValue;
                    });
                  }),
                  itemCount: pageLength,
                  itemBuilder: (context, index) => _creditCard(context, currentIndexPage),
                ),
              ),
              // DOTS INDICTOR AREA
              Padding(
                padding: const EdgeInsets.only(top: 16.0),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    DotsIndicator(
                      dotsCount: pageLength,
                      position: double.parse('$currentIndexPage'),
                      decorator: DotsDecorator(
                        color: Colors.black38,
                        activeColor: Colors.red,
                        size: const Size.square(9.0),
                        activeSize: const Size(18.0, 9.0),
                        activeShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)),
                      ),
                    )
                  ],
                ),
              ),

flutter doctor -v:

[✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.2 20D80 darwin-x64, locale en-GB)
    • Flutter version 1.22.6 at /Users/*********/flutter
    • Framework revision 9b2d32b605 (6 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/*********/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/*********/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin installed
    • Dart plugin version 201.9335
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin installed
    • Dart plugin version 203.6912

[✓] Connected device (1 available)
    • iPhone 11 (mobile) • 92E3**************************************E72 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)





Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions