dartin
फ्लटर डेवलपर्स के लिए एक व्यावहारिक हल्का डिपेंडेंसी इंजेक्शन फ्रेमवर्क।
फ्लटर डेवलपर्स के लिए एक व्यावहारिक हल्का डिपेंडेंसी इंजेक्शन फ्रेमवर्क।
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
A pragmatic lightweight dependency injection framework for Flutter developers.
A light container inspired by flutter-provide and koin.
more examples see mvvm_flutter.
dependencies:
dartin: ^0.1.5
single:Creates a provider which will initialize using the [_DartInFunction] the first time the value is requested.
factory:Creates a provider that provides a new value using the [_DartInFunction] for each requestor of the value.
inject:get T from dartIns by T.runtimeType and params
more informations see dartin.dart.
//scope should always be initialized as a static const and passed around.
const test = DartInScope('test');
final viewModelModule = Module([
factory<HomeProvide>(({params}) => HomeProvide(params.get(0), get<GithubRepo>())),
])
..withScope(test , [
///other scope
factory<HomeProvide>(({params}) => HomeProvide(params.get(0), get<GithubRepo>())),
]);
final repoModule = Module([
single<GithubRepo>(({params}) => GithubRepo(get<GithubService>())),
]);
final remoteModule = Module([
single<GithubService>(({params}) => GithubService()),
]);
final appModule = [viewModelModule, repoModule, remoteModule];
void main() {
startDartIn(appModule);
runApp(MyApp());
}
//default
final service = inject<GithubService>();
//pass parameters
final test = inject<HomeProvide>(params: ['title']);
//different scope
final test = inject<HomeProvide>(scope:test,params: ['title']);
DartIn is easy to use, and still improving.
🍺 welcome to fork and pull request。
【Medium】:DartIn:A pragmatic lightweight dependency injection framework for Flutter developers
【简书】:为Flutter而生的轻量级依赖检索容器—DartIn
【掘金】:为Flutter而生的轻量级依赖检索容器—DartIn
BSD
निर्भरता सूची 2 आइटम
{"sdk":"flutter"}{"sdk":"flutter"}उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗