View analysis_options.yaml
This file contains 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
analyzer: | |
errors: | |
# treat missing required parameters as a warning (not a hint) | |
missing_required_param: warning | |
# treat missing returns as a warning (not a hint) | |
missing_return: warning | |
linter: | |
rules: | |
- always_declare_return_types |
View Flutter: Webview loading URL
This file contains 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
final _webViewPlugin = FlutterWebviewPlugin(); | |
@override | |
Widget build(BuildContext context) { | |
return WillPopScope( | |
child: WebviewScaffold( | |
url: "https://www.google.com", | |
withZoom: false, | |
withLocalStorage: true, | |
withJavascript: true, |
View Flutter Image as ListView Separator
This file contains 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
@override | |
Widget build(BuildContext context) { | |
return ListView.separated( | |
padding: EdgeInsets.only(top: 8), | |
separatorBuilder: (context, index) => Icon(Icons.add), | |
itemBuilder: (BuildContext context, int index) { | |
return ListTile( | |
title: Text(list[index].title), | |
leading: Image.network(list[index].image_url), | |
subtitle: Text(list[index].subtitle), |
View Flutter Seperated ListView
This file contains 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
@override | |
Widget build(BuildContext context) { | |
return ListView.separated( | |
padding: EdgeInsets.only(top: 8), | |
separatorBuilder: (context, index) => Divider( | |
height: 2, | |
color: Colors.red, | |
), | |
itemBuilder: (BuildContext context, int index) { | |
return ListTile( |
View Flutter ListView
This file contains 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
@override | |
Widget build(BuildContext context) { | |
return ListView.builder( | |
itemBuilder: (context, index) { | |
return ListTile( | |
title: Text(list[index].title), | |
leading: Image.network(list[index].image_url), | |
subtitle: Text(list[index].subtitle), | |
); | |
}, |
View RxSchedulersOverrideRule.java
This file contains 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
package com.itcse.beerrecepies; | |
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; | |
import java.util.concurrent.Callable; | |
import io.reactivex.Scheduler; | |
import io.reactivex.android.plugins.RxAndroidPlugins; |
View AppModule.java
This file contains 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
@Module(includes = { | |
AndroidInjectionModule.class, RepositoryModule.class, | |
MySharedPreferencesModule.class | |
ViewModelModule.class, LocalRepositoryModule.class, MQTTModule.class | |
}) | |
abstract class AppModule { | |
/* | |
* Singleton annotation isn't necessary since Application instance is unique but is here for | |
* convention. In general, providing Activity, Fragment, BroadcastReceiver, etc does not require | |
* them to be scoped since they are the components being injected and their instance is unique. |
View ViewModelModule.java
This file contains 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
@Module | |
public abstract class ViewModelModule { | |
@Binds | |
@IntoMap | |
@ViewModelKey(SplashScreenViewModel.class) | |
abstract ViewModel bindSplashScreenViewModel(final SplashScreenViewModel splashScreenViewModel); | |
@Binds | |
@IntoMap | |
@ViewModelKey(LoginActivityViewModel.class) |
View CustomViewModelFactory.java
This file contains 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
@Singleton | |
public class CustomViewModelFactory implements ViewModelProvider.Factory { | |
private final Map<Class<? extends ViewModel>, Provider<ViewModel>> creators; | |
@Inject | |
CustomViewModelFactory(Map<Class<? extends ViewModel>, Provider<ViewModel>> creators) { | |
this.creators = creators; | |
} | |
@NonNull |