Your Second Flutter App

Nov 30 2021 · Dart 2.13, Flutter 2.2.3, Visual Studio Code

Part 1: Parse Network Data

04. Use a Model & Repository

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 03. Understand Futures Next episode: 05. Make a Network Call

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

As you progress in your career in mobile development, you’ll gain an appreciation for the architecture of your app project. Architecture in this context means the structure of your codebase, how different components in your code are connected and depend on one another.

class Course {
  final String courseId;
  final String name;
  final String description;

  Course(
    this.courseId,
    this.name,
    this.description,
  );
}
abstract class Repository {
  Future<List<Course>> getCourses(int domainFilter);
}
import '../model/course.dart';
import 'repostiory.dart';
class CourseRepository implements Repository {
}
  String dataURL =
      'https://api.raywenderlich.com/api/contents?filter[content_types][]=collection';
  @override
  Future<List<Course>> getCourses(int domainFilter) async {
    final courses = <Course>[];

    return courses;
  }
import '../model/course.dart';
import '../constants.dart';
    var url = dataURL;

    if (domainFilter != Constants.allFilter) {
      url += ';&filter[domain_ids][]=$domainFilter';
    }