vb10 / flutter-architecture-template Goto Github PK
View Code? Open in Web Editor NEWFlutter Architecture Complete App
Home Page: https://vb10.dev/#/
License: Apache License 2.0
Flutter Architecture Complete App
Home Page: https://vb10.dev/#/
License: Apache License 2.0
İnternet olmadığı zaman gösterilecek popupı vexananın sağladığı NoNetwork ile çözmeye çalıştım fakat vexana_manager.dart kısmında context istediği için başaramadım contexte ulaşamıyorum.Nasıl yapacağımı bilen varsa yardım edebilirse teşekkür ederim
Contribution kısmındaki kişinin bağlantıda ya hata var ya da hesabı kapatmış. linkedin beni 404 sayfasına atıyor
I found out that dispose method of TextEditingController in LoginViewModel is not called when dispose should be called.
In BaseView class dispose is mentioned, however it was not implemented in LoginView. I tried to solve it, but I couldn't dispose, because dispose's type is VoidCallback, so it is not possible to get viewModel (LoginViewModel) in dispose method. So I changed:
final VoidCallback? onDispose;
.
.
@override void dispose() {
super.dispose();
if (widget.onDispose != null) widget.onDispose?.call();
}
to
final Function(T model)? onDispose;
.
.
.
@override
void dispose() {
if (widget.onDispose != null) widget.onDispose!(model);
super.dispose();
}
and called dispose in this way in LoginView
return BaseView<LoginViewModel>(
viewModel: LoginViewModel(),
onModelReady: (model) {
model.setContext(context);
model.init();
},
onDispose: (model) {
model.dispose();
},
I hope it is helpful. I might be completely wrong, so take it easy :)
Hocam , benim bir sorum olacaktı.
Singleton yapılar için getIt kütüphanesini kullanarak yapmak daha clean code yazmak açısından daha faydalı olur muydu?
Bunu önerir misiniz yoksa kullanmamanızın özel bir nedeni var mı acaba?
Hi team
In your API service class you are just checking if response is type of particular type (model) thn only return else null... so how can you show user exact error that what happen .. Example in login, user can put wrong OTP so we have to show "Invalid OTP" or may be user enter expired OTP so we need to show "OTP expired"
But in your case we cant show this. Or may be i am wrong ... please suggest a way am using Vexana
`final response = await manager.send<LoginResponseModel, LoginResponseModel>(NetworkRoutes.LOGIN.rawValue,
parseModel: LoginResponseModel(), method: RequestType.POST, data: model);
if (response.data is LoginResponseModel) {
return response.data;
} else {
return null;
}`
am using baseview for my view ... init and setcontext is working fine ... how dispose will work?
i want to dispose my controllers (initialised in viewmodel) when i move to other screen.. how it is possible?
lib\core\init\network\core.dio
olmalı.
Ayrıca
[
{
"create_date": "2020-10-06 19:14:21",
"is_read": false,
"notification_data": {
"photo_id": 284,
"user_id": 7,
},
"notification_type": "photo_comment"
},
...
]
tarzı içiçe modellerde _responseParser'ın kullanımı mümkün değil sanırım ya da ben beceremedim.
Flutter'ı upgrade ettikden sonra böyle bir hata aldım.
hata: 'BaseViewModel.context' ('BuildContext? Function()') isn't a valid override of 'Store.context' ('ReactiveContext Function()').dartinvalid_override
Projede TestView çalıştırdığımda
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (11095): The following _TypeError was thrown building TestView(state: _TestViewState#52d55):
I/flutter (11095): type '(TestViewModel) => Null' is not a subtype of type '(Store) => dynamic'
Hatası alıyorum. BaseView InıtState e kadar gidiyor fakat ViewModel null geliyor View'a ve hata veriyor.
Deneyen var mı ?
Nested objeleri json_serializable paketi ile generate ettiğimiz zaman alt nesneyi "object.fromJson()" ile alıyor bu da base_model de tanımladığımız "object fromJson()" metoduna uymuyor.
Örnek olarak:
Sku nesnesindeki Price objesini generate ederken Price.fromJson()
@JsonSerializable()
class Sku implements BaseModel<Sku> {
int id;
int stock;
String attributesNames;
String title;
Price price; // <-----
Sku({this.id, this.stock, this.attributesNames, this.title, this.price});
@override
Sku fromJson(Map<String, dynamic> json) => _$SkuFromJson(json);
@override
Map<String, dynamic> toJson() => _$SkuToJson(this);
}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Sku _$SkuFromJson(Map<String, dynamic> json) {
return Sku(
id: json['id'] as int,
stock: json['stock'] as int,
attributesNames: json['attributesNames'] as String,
title: json['title'] as String,
price: json['price'] == null
? null
: Price.fromJson(json['price'] as Map<String, dynamic>), // <----- Bulunamayan metod
);
}
Map<String, dynamic> _$SkuToJson(Sku instance) => <String, dynamic>{
'id': instance.id,
'stock': instance.stock,
'attributesNames': instance.attributesNames,
'title': instance.title,
'price': instance.price,
};
@JsonSerializable()
class Price implements BaseModel<Price> {
double cardinal;
final String currency;
Price({this.cardinal, this.currency});
@override
Price fromJson(Map<String, dynamic> json) => _$PriceFromJson(json);
@override
Map<String, dynamic> toJson() => _$PriceToJson(this);
String toTLPrice() {
return this.cardinal.toStringAsFixed(2) + ' ' + this.currency;
}
}
BaseModelden overide ettiğimiz "fromJson()" metodu ile birlikte paketin serializa edebilmesi için "factory Price.fromJson()" da eklemek gerekiyor galiba BaseModel kullanma işi burada patlıyor
Hocam merhaba temelden zirveye ve architecture serilerinizi bitirmiş birisi olarak gözüme takılan bir nokta oldu . Şuan yapmakta olduğum uygulamayı mobx ile kurgulamaktayım fakat tabbardaki bir sayfaya her gelişimde servise tekrardan istek atıyor.automaticKeepAliveClientMixin i temelden zirveye serinizde kullandığınızı hatırlıyorum fakat bu statefullwidget ile birlikte kullanılabiliyor.Mobx için bunun bir çözümü yok mu acaba bütün sayfanın kurgusunu mu değiştirmem gerekiyor . Yardımcı olursanız sevinirim saygılar
Eskisi:
static const EMAIL_REGIEX = r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}\$';
Yenisi:
static const EMAIL_REGIEX =r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+";
Şeklinde değiştirilmesi lazım
test("String Helper Upper Case", () {
String text = " Helelo";
text = stringHelper.toUpper(text);
expect(text.contains(RegExp("[A-Z\s]+")), true);
});
toUpper fonksiyonu çağrılmadığında da test geçiyor. RegExp sanırım string içinde uppercase var mı diye kontrol ediyor bu şekilde. Belki testte expecti elle vermek çözebilir daha iyi bir yöntem bulamadım :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.