-
Notifications
You must be signed in to change notification settings - Fork 734
Closed
Description
This is the part of my code that use swiper.
@override
Widget build (BuildContext context) {
return new Center(
child: new Container(
child: new Container(
height: 280.0,
child: new Swiper(
itemBuilder: (BuildContext context,int index){
return new Image.network("http://via.placeholder.com/350x150",fit: BoxFit.fill,);
},
itemCount: 3,
pagination: new SwiperPagination(),
control: new SwiperControl(),
),
),
)
);
}
And cause exception:
I/flutter ( 4576): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 4576): The following NoSuchMethodError was thrown building Container(constraints:
I/flutter ( 4576): BoxConstraints(0.0<=w<=Infinity, h=280.0)):
I/flutter ( 4576): Attempted to use type '_SwiperState' as a function. Since types do not define a method 'call', this
I/flutter ( 4576): is not possible. Did you intend to call the _SwiperState constructor and forget the 'new' operator?
I/flutter ( 4576): Receiver: _SwiperState
I/flutter ( 4576): Tried calling: _SwiperState()
I/flutter ( 4576):
I/flutter ( 4576): When the exception was thrown, this was the stack:
I/flutter ( 4576): #0 Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
I/flutter ( 4576): #1 Swiper.createState (package:flutter_swiper/src/swiper.dart:260:24)
I/flutter ( 4576): #2 new StatefulElement (package:flutter/src/widgets/framework.dart:3693:23)
I/flutter ( 4576): #3 StatefulWidget.createElement (package:flutter/src/widgets/framework.dart:781:42)
I/flutter ( 4576): #4 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2888:40)
...
What happend...
Metadata
Metadata
Assignees
Labels
No labels