how to get flutter packages code example
Example 1: get package flutter
class Home extends StatelessWidget {
final controller = Get.put(Controller());
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("counter")),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GetBuilder(
builder: (_) => Text(
'clicks: ${controller.count}',
)),
RaisedButton(
child: Text('Next Route'),
onPressed: () {
Get.to(Second());
},
),
],
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: controller.increment(),
),
);
}
}
class Second extends StatelessWidget {
final Controller ctrl = Get.find();
@override
Widget build(context){
return Scaffold(body: Center(child: Text("${ctrl.count}")));
}
}
Example 2: pubspec.yaml flutter
dependencies:
url_launcher: ^5.4.0 # Good, any 5.4.x version where x >= 0 works.
image_picker: '5.4.3' # Not so good, only version 5.4.3 works.