base_models 2.0.0
base_models: ^2.0.0 copied to clipboard

Flutter package for have base models.

Library for havign base errors, models and constants.

Using #

For use errors


import 'package:base_models/base_models.dart';

throw ApiException(200, {'message':'Message'});
throw AppException(code: 'code',title: 'Title',description: 'Description');
throw BadRequestException('code', 'description', [Reason('field', 'Field required')]);
throw NotInternetException();

For use BaseModel


import 'package:base_models/base_models.dart';

class MyObject with BaseModel {
  String objectId;
  String value;

  MyObject({
    this.value,
  });

  @override
  String get id => objectId;

  @override
  Map<String, dynamic> toJson() {
    return {
      'objectId': objectId,
      'value': value,
    };
  }
}

For use L10nConstants


import 'package:base_models/base_models.dart';

var message = L10nConstants.defaultError;

0
likes
100
pub points
17%
popularity

Flutter package for have base models.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on base_models