nylo-core / support Goto Github PK
View Code? Open in Web Editor NEWSupport library for the Nylo framework. This library supports routing, widgets, localization, cli, storage and more.
Home Page: https://nylo.dev
License: MIT License
Support library for the Nylo framework. This library supports routing, widgets, localization, cli, storage and more.
Home Page: https://nylo.dev
License: MIT License
Text Widget textScaler property not found on flutter 3.13.9 ,Using textScaleFactor as an alternative
I'm getting exception while adding route guard to a route as below.
router.route(DashboardPage.path, (_) => DashboardPage()).addRouteGuard(AuthRouteGuard());
E/flutter ( 8167): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Cannot add to an unmodifiable list
E/flutter ( 8167): #0 UnmodifiableListMixin.add (dart:_internal/list.dart:114:5)
E/flutter ( 8167): #1 NyRouterRoute.addRouteGuard (package:nylo_support/router/models/nyrouter_route.dart:88:18)
E/flutter ( 8167): #2 appRouter.<anonymous closure> (package:nalco_netra/routes/router.dart:15:72)
E/flutter ( 8167): #3 nyRoutes (package:nylo_support/router/router.dart:30:8)
E/flutter ( 8167): #4 appRouter (package:nalco_netra/routes/router.dart:8:16)
E/flutter ( 8167): #5 RouteProvider.boot (package:nalco_netra/app/providers/route_provider.dart:7:20)
E/flutter ( 8167): #6 bootApplication (package:nylo_support/providers/providers.dart:17:39)
Hi, I have a question. I am trying out Nylo and having a problem with the localization, specifically the updateLocale
method. As you can see in the snippet below, the method doesn't return anything. When I was trying to switch between two locales, sometimes the locale doesn't change. I'm guessing this is because the reloadLocale
hasn't finished updating the locale. Is it possible to make updateLocale
return a Future of when the locale has been updated. Thanks in advance!
// File: support/lib/localization/app_localization.dart
/// A locale class used to manage the current locale state.
class AppLocale {
/// Updates the current locale for the app.
/// Provide the [locale] you wish to use like Locale("es")
/// The locale needs to also exist within your /lang directory
updateLocale(BuildContext context, Locale locale) {
this.locale = locale;
reloadLocale(context, locale);
}
}
I've been trying to debug this issue for a couple hours now, but not sure what's going wrong and would really appreciate some help.
Context:
I hit the following error when trying to fetch / authenticate a user.
_AssertionError ('package:nylo_support/networking/models/default_response.dart': Failed assertion: line 11 pos 12: 'decoders.containsKey(type)': Your config/decoders.dart file does not contain a decoder for the following class: User in modelDecoders)
in fact, the decoders
is returning an empty map (list), which is why it can't find the 'User' key. But my modelDecoders is definitely defined. See below for the relevant code.
Future<User?> logIn(String email, String password) async {
return await network<User>(
request: (request) => request
.post("/api/v1/auth", data: {"email": email, "password": password}),
);
}
And the modelDecoders does in fact contain the User:
final Map<Type, dynamic> modelDecoders = {
List<User>: (data) =>
List.from(data).map((json) => User.fromJson(json)).toList(),
User: (data) => User.fromJson(data),
List<Product>: (data) =>
List.from(data).map((json) => Product.fromJson(json)).toList(),
Product: (data) => Product.fromJson(data),
List<Vote>: (data) =>
List.from(data).map((json) => Vote.fromJson(json)).toList(),
Vote: (data) => Vote.fromJson(data),
};
The User model is also correct:
import 'package:nylo_framework/nylo_framework.dart';
class User extends Model {
String? id;
String? frlId;
String? username;
String? gender;
String? email;
String? token;
String? sessionId;
User({
required this.id,
this.username,
this.gender,
this.frlId,
required this.email,
required this.token,
this.sessionId,
});
User.fromJson(dynamic data) {
id = data['id'];
frlId = data['frl_id'];
username = data['username'];
gender = data['gender'];
email = data['email'];
token = data['token'];
sessionId = data['session_id'];
}
@override
Map<String, dynamic> toJson() => {
"id": id,
"frl_id": frlId,
"email": email,
"token": token,
"username": username,
"gender": gender,
"session_id": sessionId,
};
}
So I am really clueless why this error is happening. Would really appreciate some assistance, been banging my head on this one for a while now.
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.