This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(CountProvider( | |
| count: 42, | |
| child: MyApp(), | |
| )); | |
| } | |
| class CountProvider extends InheritedWidget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(CounterUpdater( | |
| child: MyApp(), | |
| )); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:provider/provider.dart'; | |
| void main() { | |
| runApp(ChangeNotifierProvider( | |
| create: (_) => Counter(), | |
| child: MyApp(), | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:provider/provider.dart'; | |
| void main() { | |
| runApp(MultiProvider( | |
| providers: [ | |
| ChangeNotifierProvider(create: (_) => Counter()), | |
| ChangeNotifierProvider(create: (_) => Clock()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_riverpod/all.dart'; | |
| final countProvider = StateProvider((ref) => 0); // declare providers anywhere | |
| final clockProvider = StateProvider((ref) => DateTime.now()); | |
| void main() { | |
| runApp(ProviderScope(child: MyApp())); // add ProviderScope at top level | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'package:flutter_riverpod/all.dart'; | |
| final container = ProviderContainer(); // declare global ProviderContainer | |
| final countProvider = StateProvider((ref) => 0); // declare providers anywhere | |
| void main() { | |
| final ProviderSubscription<StateController<int>> subscription = container.listen(countProvider, didChange: (sub) { // listen from container | |
| print(sub.read().state); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'dart:async'; | |
| import 'dart:math'; | |
| const originalMap = [ | |
| [1,1,1,1,1,1,1,1,1,1,1,], | |
| [1,0,0,0,0,0,0,0,0,0,1,], | |
| [1,0,1,0,1,0,1,0,1,0,1,], | |
| [1,0,1,0,1,1,1,0,1,0,1,], | |
| [1,0,1,0,0,0,0,0,1,0,1,], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/cupertino.dart'; | |
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(App()); | |
| } | |
| class App extends StatelessWidget { | |
| final doubleListQueue = ["personalName", "carrierType", "email"]; | |
| final tripleListQueue = ["companyName", "taxID", "email"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/cupertino.dart'; | |
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(MaterialApp( | |
| home: Scaffold( | |
| body: Center( | |
| child: Text("Please help me!!!"), | |
| ), | |
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp( | |
| MaterialApp( | |
| home: App(), | |
| ), | |
| ); | |
| } |
OlderNewer