Комментарии:
What was the reason for referencing the fixtures by the file name instead of the variable name? Is it just so that the variable name doesn't matter, or not to add another import?
ОтветитьThank you so much man, great video! I have a question: What do you do when you need to access the same entity and model from multiple features?
ОтветитьThis series is GOLD
ОтветитьWhat do you do when you need to access the same entity and model from multiple features? (great vids btw!)
ОтветитьYou said that the entity should be independent from anything, but you are using a package inside the class, Equatable, I am not sure it a good idea. Plus you are using dartz (Either) inside the domain too. Could you please explain more about it?
ОтветитьThis is the best series on internet
Ответить♥
ОтветитьGreat
ОтветитьExcelent content
ОтветитьYou have to make a abstract class Mapper<Entity, T>
Then your Model have to implement Mapper
Mapper have two main method
toModel
fromModel
Fixtures?!!!
I did not hear that.
Use "dummy_data" instead of "mixtures" for your folder name.
Top tier course. Thanks a lot Reso Coder.
ОтветитьWith this separation how would you implement JSON Serializable. Since, we need to introduce json serializable annotations into entity class because properties will be there. We are coupling json serializable package to our domain layer. Which is bad according to plug in plug out situations. So what do you think?
ОтветитьThank you so much for this series !
ОтветитьWhen I use
expect(tNumberTriviaModel, isA<NumberTrivia>());
it returns:
Expected: <Instance of 'NumberTrivia'>
Actual: NumberTriviaModel:<NumberTriviaModel(Test Text, 1)>
Which: is not an instance of 'NumberTrivia'
Not sure if isA is expected to use as checking the parent class.
the NumberTriviaRepository in domain layer is created just to write test for usecases, right?
ОтветитьI don't know why but I really hate TDD. -_-
anyone out there like me?
What if we want to show double when double comes from json and show int when int comes from json? Should we create 2 model classes?
Ответитьi think you forgot to include in the video how to implement json in pubsec.yaml
ОтветитьHi Everyone! Can somebody help me? I don't know why, but the last test fail (toJson), rewrite many times, but I guess is not a typo. It's because null safety?
Message Error:
Expected: {'text': 'Test text', 'number': 1}
Actual: {'text': null, 'number': null}
Which: at location ['text'] is <null> instead of 'Test text'
This tutorial is awesome. Thanks :)
ОтветитьDoes anyone know how to get his aaa Test snippet?
ОтветитьI have a question:
What are the reasons for the Model classes to extends the Entity classes?
I tried to apply this concept in my project and came to a dead end, so I had to relay on Models to feed my UI with data.
So I was wondering if there any obvious reasons for this approach?
I would like to share a snippet of my code, but that would be inappropriate here.
Finally, I would like to thank you for the great effort you put in your courses.
Keep the goodies coming !!
fromJson doesn't work !! test is not working it shows error and I can't figure it out
ОтветитьA los que les funciona la lectura del JSON, pueden usar este código remplazando todo fixture_reader.dart :
String fixture(String name) {
var dir = Directory.current.path;
dir = dir.replaceAll('\\', '/');
if (dir.endsWith('/test')) {
dir = dir.replaceAll('/test', '');
}
return File('$dir/test/fixtures/$name').readAsStringSync();
}
Correct me if I am wrong but you planned the implementation of fromJson in order to accept large double numbers from the API . By converting numbers to num and then to int you cannot be sure that your code will not break in a larger number(i.e. 10^40) which is bigger than int predefined limits from the api. Generally your tutorial is great by the way .
ОтветитьHi Reso Coder, where would you convert an integer stored in db to a money class used in the ui? As Clean architecture confuses me (have some experience in DDD). I am asking because your entity is a subclass of model, meaning the number and the text has same type, while in my case they would be different. Thx in advance.
ОтветитьHow works model extends entity that contains a List? In my case, show me a error: "....('void Function(List<ResultMoviesRatingsModel>)') isn't a valid override of 'ResultMovieDetailsEntity.ratings='...."
ОтветитьGreat Video!1
ОтветитьJust in case someone is stuck with error running this outside VScode.
If you have this error when trying to use code for fixture reader provided,
FileSystemException: Cannot open file, path = 'test/fixtures/trivia.json' (OS Error: No such file or directory, errno = 2)
use this code instead
import 'dart:io';
String fixture(String name) {
var dir = Directory.current.path;
if (dir.endsWith('/test')) {
dir = dir.replaceAll('/test', '');
}
return File('$dir/test/fixtures/$name').readAsStringSync();
}
it appears, that VSCode dev env is different from CLI or, say, IntelliJ (that I use), so that's more "general" solution.
Thank u Reso Coder, I have a question suppose the data source am using is firestore, the response will be document instead of json, so how should apply the same concepts
Ответитьnumbersapi can also return `null` for the number, which it counts as "infinity"
in order to find all possible responses, api documentation should probably be consulted
How will you handle a complex list with this.
ОтветитьHi, why should be use a factory construc in this case?
ОтветитьI have an error in test like Expected: <Instance of 'ConcreteNumberModel'>
Actual: <Instance of 'ConcreteNumberModel'>
Microsoft eShopOnWeb project show an every good example of clean architecture.
ОтветитьSuperb stuff indeed!
One note though on fixture_reader.dart file. When you run your tests locally, this will work, but if you try to use some kind of ci tool, your tests will fail. This is because ci tools need relative path. You can add a try/catch pattern here to avoid it.
I change it to this:
import 'dart:io';
String fixture(String name) {
String jsonString;
try {
jsonString = File('test/fixtures/$name').readAsStringSync();
} catch (e) {
jsonString = File('../test/fixtures/$name').readAsStringSync();
}
return jsonString;
}
Hope this helps someone.
If I was working on a login feature, how what would I do? For example, using Firebase: after login we receive a FirebaseUser. What entities should I create? What the model should do?
ОтветитьHow to write tests for example an API that returns lists of text for multiple numbers?
ОтветитьHi Matej, thank you for sharing your fantastic videos. I really learn a lot. Question: would it be possible for you to make a video on how to test Firebase interface in terms of documents and collections messaging back and forth? Thanks!
ОтветитьIn the written tutorial you say that in this example we do not need a Mapper class for the conversion logic.
Can you explain how you would implement a Mapper class in this project if you need to add one?
Done!!! :D
ОтветитьI really appreciate this man!!! you are doing the public a service, I will be refactoring all my code to follow your guidelines
ОтветитьNice videos. Though, did you realize that by simplifying the double case to just 1.0 you totally ended up fixing likely a non issue (assuming the api really always returns Integers) and actually masking the real problem? The problem is the numbers are way too large to be contained in ints and the real fix would be to use a suitable datatype in the first place. Your ints are now overflowing and the doubles are reduced to some entirely different garbage values making no sense e.g. 1e+40 ==> 10000000000000000000000000000000000000000.0.toInt() == 9223372036854775807
ОтветитьCan't we use BuiltValue in the data layer for the serialization and deserialization?
ОтветитьVery nice Course!!! Thanks man!
Ответить