jio_provider 1.0.2
jio_provider: ^1.0.2 copied to clipboard
Simple light weight provider inherited widget, basic, multi, eager and lazy jio providers.
jio_provider #
Description(s) #
A Flutter package for android, iOS and web which provides reactive widget. Two types of JioProvider are available:
- BasicJioProvider
- MultiJioProvider
MultiJioProvider has two approaches:
- EagerJioProvider
- LazyJioProvider
- LazyJioAsyncProvider
- LazyJioUniversalProvider
Performance Metrics #
- Build Status: The current status of the CI build.
- Build Time: Average build time for the CI.
Getting Started #
Published package url -
https://pub.flutter-io.cn/packages/jio_provider
Usage #
To use this package :
- add the dependency to your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
jio_provider:
How to use #
import 'package:flutter/material.dart';
import 'package:jio_provider/jio_provider.dart';
void main() {
runApp(BasicJioProvider(notifier: CounterViewModel(), child: const MyApp()));
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: CounterView(),
);
}
}
class CounterViewModel extends JioNotifier {
bool _option = false;
int _count = 0;
bool get option => _option;
int get count => _count;
void changeOption() {
_option = !_option;
notifyListeners();
}
void increment() {
_count++;
notifyListeners();
}
}
class CounterView extends StatelessWidget {
const CounterView({super.key});
@override
Widget build(BuildContext context) {
final counter = JioProvider.of<CounterViewModel>(context); // OK | OK for small app
return Scaffold(
appBar: AppBar(title: Text(counter.option ? 'OPTION1' : 'OPTION2')),
body: Column(
children: [
Center(
child: Row(
children: [
ElevatedButton(
onPressed: () => counter.changeOption(),
child: Text('OPTIONS'),
),
],
),
),
Center(
child: Text(
'Count: ${counter.count}',
style: const TextStyle(fontSize: 28),
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: counter.increment,
child: const Icon(Icons.add),
),
);
}
}
License #
Copyright (c) 2025 Jiocoders
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Getting Started #
For help getting started with Flutter, view our online documentation.
For help on editing package code, view the documentation.